How do I set a value in VBA? (1 Viewer)

Big Pat

Registered User.
Local time
Today, 15:08
Joined
Sep 29, 2004
Messages
555
Quick question:
What’s the syntax for setting the value of the field [PropertyNo] on frmPropertyChecks, to be the same as the field [PropertyID] on frmProperties?

Long-winded explanation below. Maybe you clever guys can get what you need from the "Exec Summary" above, but in case you need to understand what I'm doing, here goes:
frmMenu has a subform subfrmProperties, which lists addresses in my table (continuous view). You click one to go to...
frmProperty which is a form (single view) filtered to show the one record clicked above (but showing all fields in tblProperties)
frmProperty has a subform subfrmPropertyChecks (continuous view), showing the dates this address was inspected. You click one of these to go to...
frmPropertyChecks (single view) where you can view/edit the full record in tblPropertyChecks.

So far so good, all that works OK.

But sometimes, when the user selects an address to work with, they need to add a NEW inspection record and I'm not sure I'm going about this the right way.

Using the command button wizard, I added a button to subfrmPropertyChecks to open frmPropertyChecks and show all the records. Next I edited the Visual Basic and added
Code:
DoCmd.GoToRecord , , acNewRec
So basically that button just opens a blank form. But I don't want the user to have to enter the PropertyID, because they have already selected the address from the menu. So I want to set the field [PropertyNo] on frmPropertyChecks, to be the same as the field [PropertyID] on frmProperties. But I can’t quite figure out the right syntax. I know very little visual basic I’m afraid.

Very grateful for some pointers. Thank you.
Pat.
 

Big Pat

Registered User.
Local time
Today, 15:08
Joined
Sep 29, 2004
Messages
555
Thanks so much for that link. It still took me a while to understand the right places to put exclamation marks and dots. And I was confused by whether to use "Me." but I got there in the end.

You've really helped me because rather than just answering the question, you've helped me understand the reasons and given me a shot at being able to work out stuff like this for myself next time.

I really appreciate it. Thank you.

Pat.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:08
Joined
Aug 30, 2003
Messages
36,125
Glad to help Pat, and I do try to "teach how to fish".
 

Users who are viewing this thread

Top Bottom