D
David
Anyone Please Help!
Typed Code To open report from search. When I click on
the Preview Button I get a runtime error #3075
"Extra ) in Query Expression"
I can't find it.
Code follows
Private Sub cmdPreview_Click()
'On Error GoTo Err_cmdPreview_Click
'Dim stDocName As String
Dim strWhere As String
Dim lngLen As Long
'stDocName = "Recording Search Report2"
'DoCmd.OpenReport stDocName, acPreview
If Not IsNull(cboRecordingArtistName) Then
strWhere = strWhere & "([RecordingArtistName])
= """ & _
cboRecordingArtistName & """) AND "
End If
If Not IsNull(cboRecordingTitle) Then
strWhere = strWhere & "([RecordingTitle]) = """ & _
cboRecordingTitle & """) AND "
End If
If Not IsNull(cboTrackTitle) Then
strWhere = strWhere & "([TrackTitle]) = """ & _
cboTrackTitle & """) AND "
End If
If Not IsNull(cboTrackNumber) Then
strWhere = strWhere & "([TrackNumber]) = """ & _
cboTrackNumber & """) AND "
End If
If Not IsNull(cboTrackLength) Then
strWhere = strWhere & "([TrackLength]) = """ & _
cboTrackLength & """) AND "
End If
If Not IsNull(cboTrackTempo) Then
strWhere = strWhere & "([TrackTempo]) = """ & _
cboTrackTempo & """) AND "
End If
If Not IsNull(cboMusicCategory) Then
strWhere = strWhere & "([MusicCategory]) = """ & _
cboMusicCategory & """) AND "
End If
If Not IsNull(cboTrackSpecialty) Then
strWhere = strWhere & "([TrackSpecialty]) = """ & _
cboTrackSpecialty & """) "
End If
lngLen = Len(strWhere) - 8
If lngLen > 0 Then
strWhere = Left$(strWhere, lngLen)
End If
'open Report
DoCmd.OpenReport "Recording Search Report",
acViewPreview, , strWhere
End Sub
Typed Code To open report from search. When I click on
the Preview Button I get a runtime error #3075
"Extra ) in Query Expression"
I can't find it.
Code follows
Private Sub cmdPreview_Click()
'On Error GoTo Err_cmdPreview_Click
'Dim stDocName As String
Dim strWhere As String
Dim lngLen As Long
'stDocName = "Recording Search Report2"
'DoCmd.OpenReport stDocName, acPreview
If Not IsNull(cboRecordingArtistName) Then
strWhere = strWhere & "([RecordingArtistName])
= """ & _
cboRecordingArtistName & """) AND "
End If
If Not IsNull(cboRecordingTitle) Then
strWhere = strWhere & "([RecordingTitle]) = """ & _
cboRecordingTitle & """) AND "
End If
If Not IsNull(cboTrackTitle) Then
strWhere = strWhere & "([TrackTitle]) = """ & _
cboTrackTitle & """) AND "
End If
If Not IsNull(cboTrackNumber) Then
strWhere = strWhere & "([TrackNumber]) = """ & _
cboTrackNumber & """) AND "
End If
If Not IsNull(cboTrackLength) Then
strWhere = strWhere & "([TrackLength]) = """ & _
cboTrackLength & """) AND "
End If
If Not IsNull(cboTrackTempo) Then
strWhere = strWhere & "([TrackTempo]) = """ & _
cboTrackTempo & """) AND "
End If
If Not IsNull(cboMusicCategory) Then
strWhere = strWhere & "([MusicCategory]) = """ & _
cboMusicCategory & """) AND "
End If
If Not IsNull(cboTrackSpecialty) Then
strWhere = strWhere & "([TrackSpecialty]) = """ & _
cboTrackSpecialty & """) "
End If
lngLen = Len(strWhere) - 8
If lngLen > 0 Then
strWhere = Left$(strWhere, lngLen)
End If
'open Report
DoCmd.OpenReport "Recording Search Report",
acViewPreview, , strWhere
End Sub