Linking fields in separate forms

gschimek

Registered User.
Local time
Today, 10:34
Joined
Oct 2, 2006
Messages
102
I have a form with contact info, which also has a subform with other data on it. The subform is a continuous mode form. If I go to the "New" line (last line) of the continuous form, I can add information, and the records are linked via the customerID field on both the form and subform.

I want to have a button on that subform that says "New" that opens up a different form in a popup. I can do that part just fine, but when I try to enter data onto the popup form, the customerID field does not populate with the ID number of the person on the main form. It defaults to a value of "0".

So, is there a way to link the 2 forms like you can with forms and subforms? Or is there a way to have the customerID field in the popup form just populate based on the other form?

Not sure if this makes sense, but please help if you can. Thanks.
 
One way:

DoCmd.OpenForm...
Forms!FormName.customerID = Me.customerID
 
OK, that worked perfectly. But...

It doesn't work if there's not already an existing record in the subform. I get an error "Syntax Error (missing operator) in query expression '[CustomerID]='.

Any ideas?
 
Last edited:
Grab the ID from the main form rather than the subform.
 
I tried that, but I'm not doing something right. Instead of:
Code:
Forms!frmClaims.customerID = Me.customerID
which works great if there's an existing record in the subform, I tried:
Code:
Forms!frmClaims.customerID = Forms!frmCustomers.customerID
where frmCustomers is the main form, frmClaimsList is the subform, with the "New" button on the form header, and frmClaims is the popup form. That didn't work for me, though.

What am I doing wrong?
 
frmCustomers has a field called customerID which is populated with the correct ID? If so, I can't see why that wouldn't work. Do you get an error or ??
 

Users who are viewing this thread

Back
Top Bottom