I used the procedure shown in another thread and am receiving a Compile error. Syntax Error.
I am trying to link to forms, and two tables by 2 fields for which both are the primary key in the secondary table. I am also trying to accomplish cascading update to the 2nd table. The command button is currently only linked by the Contract field and isn't updating the SITECMF field. Consequently the second form is showing all Records for that contract.
I tried to change the VB code to account for both fields and am getting an error: Compile Error. Syntax Error.
My fields are
SITECMF - Text Field
CONTRACT - Number Field
Here is the code:
Private Sub SITEDET_CMD_Click()
On Error GoTo Err_SITEDET_CMD_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSite"
stLinkCriteria = "[SITECMF]= '" & Me!SITECMF& "'AND [CONTRACT]="& Me![CONTRACT]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_SITEDET_CMD_Click:
Exit Sub
Err_SITEDET_CMD_Click:
MsgBox Err.Description
Resume Exit_SITEDET_CMD_Click
End Sub
Help!
Nanci
[sig][/sig]
I am trying to link to forms, and two tables by 2 fields for which both are the primary key in the secondary table. I am also trying to accomplish cascading update to the 2nd table. The command button is currently only linked by the Contract field and isn't updating the SITECMF field. Consequently the second form is showing all Records for that contract.
I tried to change the VB code to account for both fields and am getting an error: Compile Error. Syntax Error.
My fields are
SITECMF - Text Field
CONTRACT - Number Field
Here is the code:
Private Sub SITEDET_CMD_Click()
On Error GoTo Err_SITEDET_CMD_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSite"
stLinkCriteria = "[SITECMF]= '" & Me!SITECMF& "'AND [CONTRACT]="& Me![CONTRACT]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_SITEDET_CMD_Click:
Exit Sub
Err_SITEDET_CMD_Click:
MsgBox Err.Description
Resume Exit_SITEDET_CMD_Click
End Sub
Help!
Nanci
[sig][/sig]