N
NeoFax
Below is the code I am using to open a report based on criteria from
three comboboxes. The problem is that the report errors as the
WhereCondition is wrong. Here is the code:
Private Sub btnJC_OpenFull_Click()
On Error GoTo Err_btnJC_OpenFull_Click
Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(cmbHelo) Then
stLinkCriteria = "[Stage#]" & "=" & """ & cmbStage & """ &
"[Responsibility]" & "=" & """ & cmbResp & """
ElseIf IsNull(cmbStage) Then
stLinkCriteria = "[HELO#]" & "=" & """&cmbHelo&""" &
"[Responsibility]" & "=" & """ & cmbResp & """
ElseIf IsNull(cmbResp) Then
stLinkCriteria = "[HELO#]" & "=" & """&cmbHelo&""" & "[Stage#]" &
"=" & """ & cmbStage & """
Else
stLinkCriteria = "[HELO#]" & "=" & """ & cmbHelo & """ & "[Stage#]"
& "=" & """ & cmbStage & """ & "[Responsibility]" & "=" & """ &
cmbResp & """
End If
stDocName = "rptJC_OpenFull"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_btnJC_OpenFull_Click:
Exit Sub
Err_btnJC_OpenFull_Click:
MsgBox Err.DESCRIPTION
Resume Exit_btnJC_OpenFull_Click
End Sub
Any help would be appreciated. Thanks!
Terry
three comboboxes. The problem is that the report errors as the
WhereCondition is wrong. Here is the code:
Private Sub btnJC_OpenFull_Click()
On Error GoTo Err_btnJC_OpenFull_Click
Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(cmbHelo) Then
stLinkCriteria = "[Stage#]" & "=" & """ & cmbStage & """ &
"[Responsibility]" & "=" & """ & cmbResp & """
ElseIf IsNull(cmbStage) Then
stLinkCriteria = "[HELO#]" & "=" & """&cmbHelo&""" &
"[Responsibility]" & "=" & """ & cmbResp & """
ElseIf IsNull(cmbResp) Then
stLinkCriteria = "[HELO#]" & "=" & """&cmbHelo&""" & "[Stage#]" &
"=" & """ & cmbStage & """
Else
stLinkCriteria = "[HELO#]" & "=" & """ & cmbHelo & """ & "[Stage#]"
& "=" & """ & cmbStage & """ & "[Responsibility]" & "=" & """ &
cmbResp & """
End If
stDocName = "rptJC_OpenFull"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_btnJC_OpenFull_Click:
Exit Sub
Err_btnJC_OpenFull_Click:
MsgBox Err.DESCRIPTION
Resume Exit_btnJC_OpenFull_Click
End Sub
Any help would be appreciated. Thanks!
Terry