opening second form to same record as currently open form

G

Guest

I have tblCustomers and tblInvoices linked in a one-to-many relationship with
key field [CustID]

I have frmCustomer with my customer demographic information and frmInvoice
which shows all the invoices for a given customer.

I have an Open Form control on frmCustomer that opens frmInvoice but I don’t
know how to make frmInvoice open to the same record that is open in
frmCustomer. Can someone guide me on how to create this record-level form to
form link?

Thanks,
spence
 
G

Guest

You can use the Where condition in the OnOpen form command line to apply the
filter to the invoice form
========================================
Dim MyWhereCondition As String
MyWhereCondition = "[InvoiceNumber] = " & Me.[InvoiceNumber field name in
form]
Docmd.OpenForm "FormName",,,MyWhereCondition
========================================
If the Invoice field type is string, then use ths
MyWhereCondition = "[InvoiceNumber] = '" & Me.[InvoiceNumber] & "'"

Adding a single quote before and after
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top