I'm trying to get my VB written to ONLY open a report if the DriverID is "SELECT CLASSIC CARRIERS". This is what I have...
Private Sub btnSHIP_Click()
On Error GoTo Err_btnSHIP_Click
Dim stLinkCriteria As String
Dim DriverName As String
DriverName = Me.DRVID
If Me.Dirty Then Me.Dirty = False
stLinkCriteria = "[Serial Number] = " & Chr(34) & Me![Serial number] & Chr(34)
DoCmd.OpenReport "rptSINGLEUNITSHIP", acViewPreview, , stLinkCriteria
DoCmd.OpenReport "rptSINGLESELECTBILLOFLADING", acViewPreview, , "DRIVERNAME = '" & "SELECT CLASSIC CARRIERS" & "'"
Exit_btnSHIP_Click:
Exit Sub
Err_btnSHIP_Click:
MsgBox Err.Description
Resume Exit_btnSHIP_Click
End Sub
It is opening regardless of who the driver is...
Private Sub btnSHIP_Click()
On Error GoTo Err_btnSHIP_Click
Dim stLinkCriteria As String
Dim DriverName As String
DriverName = Me.DRVID
If Me.Dirty Then Me.Dirty = False
stLinkCriteria = "[Serial Number] = " & Chr(34) & Me![Serial number] & Chr(34)
DoCmd.OpenReport "rptSINGLEUNITSHIP", acViewPreview, , stLinkCriteria
DoCmd.OpenReport "rptSINGLESELECTBILLOFLADING", acViewPreview, , "DRIVERNAME = '" & "SELECT CLASSIC CARRIERS" & "'"
Exit_btnSHIP_Click:
Exit Sub
Err_btnSHIP_Click:
MsgBox Err.Description
Resume Exit_btnSHIP_Click
End Sub
It is opening regardless of who the driver is...