Hi, I can't seem to combine these to one button. I need to open a form based on the values in two fields.
Seperatly they work, when i try to combine them using the AND function it comes up with the error data mismatch.
Any advice?
this is what i have but with the error
Seperatly they work, when i try to combine them using the AND function it comes up with the error data mismatch.
Code:
Private Sub cmdEvidenceSummary_Click()
On Error GoTo Err_cmdEvidenceSummary_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "F_EvidenceSummary"
stLinkCriteria = "[Unit]=" & Me![Unit]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdEvidenceSummary_Click:
Exit Sub
Err_cmdEvidenceSummary_Click:
MsgBox Err.Description
Resume Exit_cmdEvidenceSummary_Click
End Sub
Code:
Private Sub Command28_Click()
On Error GoTo Err_Command28_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "F_EvidenceSummary"
stLinkCriteria = "[Identifier]=" & Me![Candidate]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command28_Click:
Exit Sub
Err_Command28_Click:
MsgBox Err.Description
Resume Exit_Command28_Click
End Sub
Any advice?
this is what i have but with the error
Code:
Private Sub cmdEvidenceSummary_Click()
On Error GoTo Err_cmdEvidenceSummary_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "F_EvidenceSummary"
stLinkCriteria = "[Identifier]=" & Me![Candidate] And "[Unit]=" & Me![Unit]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdEvidenceSummary_Click:
Exit Sub
Err_cmdEvidenceSummary_Click:
MsgBox Err.Description
Resume Exit_cmdEvidenceSummary_Click
End Sub