opening a related form

  • Thread starter Thread starter dosima
  • Start date Start date
D

dosima

Hi i have a main form with cutomer details, and i want there to be a related
popup form where users can enter customers bank details.
i have tried to do this but cannot get it to work.

i have a customer table and a bank table. at the moment the relationship is
one customer has many bank details. i;m not sure if this correct though.

Also not every customer will have bank details so some popup forms will be
blank.
But the main problem is that i cant work out how to make the popup form only
show that certain customers bank details when on that customers record.

if anyone could help, that would be great
thanks
 
DoCmd.OpenForm "frmName",,,"CustomerID=" & Me.txtCustomerID

where:

frmName is the form's name
CustomerID is the field name
txtCustomerID is the text control name
 
Hi

i have put this code in the customer form. When i click the button it tells
me to enter a parameter value Me.txtCustomerID.

Can you tell me what i need to do so it doesnt come up with this message. Am
i suppose to put anything on the Bank popup form.

Thanks
 
dosima said:
Hi

i have put this code in the customer form. When i click the button it
tells me to enter a parameter value Me.txtCustomerID.

Do you have a field on the form named txtCustomerID? Does your code's
structure (quotes mostly) look exactly like what Arvin posted or just
similar?

When you have it correct you will not be prompted for a parameter.
 
Hi
I do have a field on the bmain form named CustomerID.
I have a text feld named txtCustomerID on the bank popup form.
the Structure is like what Arvin quoted - apart from the form name changed
to the correct form name.

Have i created it the correct place - it is in a macro that opens frmBank
and the other part CustomerID=" & Me.txtCustomerID is in the where part.
 
txtCustomerID is being called from the main form (the form where the button
resides), CustomerID is the field in the recordset which is in the
recordsource of the popup form. So try CustomerID instead of txtCustomerID

BTW, I assumed that the CustomerID field is an autonumer (Long Integer). If
it is text, the code would read:

DoCmd.OpenForm "frmName",,,"CustomerID=" & "'" & Me.CustomerID & "'"
 
Back
Top