T
tim johnson
I have a form and subform in a 1 to many relationship. The main form is
called frmMain and the subfrom is called frmSub. frmMain is linged to tblMain
and has 2 fields, CustomerID as primary key and the second field is
CustomerName.
frmSub is linked to tblSub and has CustomerID , SubID as the primary key and
a few more fields not relevant to my question.
All primary keys are AutoNumber with long data type.
The customer with customerID = 2 had 12 records in the sub form.
I have an unbound form and when I click a cmdButton I want to open frmMain
at customerID 2 in the main form and also find the record where the SubID = 5.
This is what I have.
DoCmd.OpenForm "frmMain", , , "CustomerID = " & 2 & _
" AND Forms!frmMain!frmSub!SubID = " & 5
The opens but displays nothing.
In a nutshell how do I open a form/subform in a 1 to many relationship at a
specific record in the many side?
called frmMain and the subfrom is called frmSub. frmMain is linged to tblMain
and has 2 fields, CustomerID as primary key and the second field is
CustomerName.
frmSub is linked to tblSub and has CustomerID , SubID as the primary key and
a few more fields not relevant to my question.
All primary keys are AutoNumber with long data type.
The customer with customerID = 2 had 12 records in the sub form.
I have an unbound form and when I click a cmdButton I want to open frmMain
at customerID 2 in the main form and also find the record where the SubID = 5.
This is what I have.
DoCmd.OpenForm "frmMain", , , "CustomerID = " & 2 & _
" AND Forms!frmMain!frmSub!SubID = " & 5
The opens but displays nothing.
In a nutshell how do I open a form/subform in a 1 to many relationship at a
specific record in the many side?