Hi
I have a form(Enquiry) which contains a subform(site) which are locked to prevent data being changed.
When a button is clicked I would like to open the currently viewed customer's details and site details in another form called: EDITEnquiry which is not locked.
I have managed to do this using one field(CustomerID) but am having trouble using two fields. - One being on the subform.
The code bellow provides me with the following error message:
Syntax error (missing operator) in query expression '[CustomerID]=2 And [Address] = 123 Site Road'.
Private Sub Edit_Click()
On Error GoTo Err_Edit_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "EDITEnquiry"
stLinkCriteria = "[CustomerID]=" & Me![CustomerID] & " And [Address] = " & Me!EnquirySiteSubform![Address]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Edit_Click:
Exit Sub
Err_Edit_Click:
MsgBox Err.Description
Resume Exit_Edit_Click
End Sub
Thanks in advance
I have a form(Enquiry) which contains a subform(site) which are locked to prevent data being changed.
When a button is clicked I would like to open the currently viewed customer's details and site details in another form called: EDITEnquiry which is not locked.
I have managed to do this using one field(CustomerID) but am having trouble using two fields. - One being on the subform.
The code bellow provides me with the following error message:
Syntax error (missing operator) in query expression '[CustomerID]=2 And [Address] = 123 Site Road'.
Private Sub Edit_Click()
On Error GoTo Err_Edit_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "EDITEnquiry"
stLinkCriteria = "[CustomerID]=" & Me![CustomerID] & " And [Address] = " & Me!EnquirySiteSubform![Address]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Edit_Click:
Exit Sub
Err_Edit_Click:
MsgBox Err.Description
Resume Exit_Edit_Click
End Sub
Thanks in advance