G
Guest
I have read the posts here that seem to deal with multiple primary keys and
haven't seen one that addresses my problem. I have a data base that has a
tblUsers table and a tblFamilyMembers table. In the Users table the Primary
Key is CustomerID and the table consists of name, address, and phone number.
The CustomerId is auto-number - the Address field is text. The Family member
table has the CustomerID and Address from the Users table as the primary key
along with the name of the person and their relation to the Customer name in
the Users table. The CustomerID field in the FamilyMembers table is number
and the Address field is text. I have a form that I have command button on to
open the Family Members form to enter the name and relationship. The Customer
field is the name of the text box field that I'm using as a look-up for the
Customer. However, I keep getting a 'type mismatch' error when I execute the
following:
Private Sub cmdFamilyMembers_Click()
On Error GoTo Err_cmdFamilyMembers_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmFamilyMembersSubForm"
stLinkCriteria = "[CustomerID]=" & Str(Nz(Me![Customer], 0)) And
"[CustomerAddress]=" & Me![Address]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdFamilyMembers_Click:
Exit Sub
Err_cmdFamilyMembers_Click:
MsgBox Err.Description
Resume Exit_cmdFamilyMembers_Click
End Sub
Any help would be greatly appreciated.
Thanks,
Randy M
haven't seen one that addresses my problem. I have a data base that has a
tblUsers table and a tblFamilyMembers table. In the Users table the Primary
Key is CustomerID and the table consists of name, address, and phone number.
The CustomerId is auto-number - the Address field is text. The Family member
table has the CustomerID and Address from the Users table as the primary key
along with the name of the person and their relation to the Customer name in
the Users table. The CustomerID field in the FamilyMembers table is number
and the Address field is text. I have a form that I have command button on to
open the Family Members form to enter the name and relationship. The Customer
field is the name of the text box field that I'm using as a look-up for the
Customer. However, I keep getting a 'type mismatch' error when I execute the
following:
Private Sub cmdFamilyMembers_Click()
On Error GoTo Err_cmdFamilyMembers_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmFamilyMembersSubForm"
stLinkCriteria = "[CustomerID]=" & Str(Nz(Me![Customer], 0)) And
"[CustomerAddress]=" & Me![Address]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdFamilyMembers_Click:
Exit Sub
Err_cmdFamilyMembers_Click:
MsgBox Err.Description
Resume Exit_cmdFamilyMembers_Click
End Sub
Any help would be greatly appreciated.
Thanks,
Randy M