report record source in properties is blank.I set recrdsource on open here is my sql (which works in a form fine but not a report)
Public searchSQL As String
searchSQL = "SELECT [tblBook].[lngBookNo] AS Valmadonna, [tblBook].[strBookName] AS BookName, [tblBook].[strBookNameHebMapped] AS [Hebrew Name], [tblBook].[strDateInNums] AS PrintDate, [tblBook].[strAuthor] AS author, [tblPrinter].[strPrinter] AS Printer, [tblType].[strType] AS Type, [tblBook].[dateStamp], [tblBook].[strDateHebMapped] AS hebdate, [tblBook].[strBibliography], [tblBook].[strNotes], [tblBook].[strSizeMapped], [tblBook].[mmoInfo], [tblbook].[mmoAddNotes], [tblCity].[strCity] AS city, [tblBook].[strDatAcronymMapped], [tblbook].[chkprint],[qrystringDates].[fromsearch],[qrystringdates].[tosearch]" & _
"FROM tblCity INNER JOIN (tblType INNER JOIN (tblPrinter INNER JOIN(tblBook INNER JOIN qrystringDates ON [tblBook].[lngBookNo] = [qrystringDates].[lngBookNo]) ON [tblPrinter].[ID]=[tblBook].[tblPrinter_ID]) ON [tblType].[ID]=[tblBook].[tblType_ID]) ON [tblCity].[ID]=[tblBook].[tblCity_ID]"
If [Forms]![frmbook]!Checkval = True Then
searchSQL = searchSQL & " WHERE [tblbook].[lngbookno]<100000 And"
Else
searchSQL = searchSQL & " WHERE"
End If
If IsNull([Forms]![frmbook]!TxtAndVal) Then
Else
searchSQL = searchSQL & " [tblbook].[lngbookno] LIKE """ & [Forms]![frmbook]![TxtAndVal] & """ AND"
End If
If IsNull([Forms]![frmbook]!txtAndTitle) Then
Else
searchSQL = searchSQL & " [tblbook].[strbookname] LIKE """ & [Forms]![frmbook]!txtAndTitle & """ AND"
End If
If IsNull([Forms]![frmbook]!txtAndAuthor) Then
Else
searchSQL = searchSQL & " [tblbook].[strauthor] LIKE """ & [Forms]![frmbook]!txtAndAuthor & """ AND"
End If
If IsNull([Forms]![frmbook]!txtAndPrinter) Then
Else
searchSQL = searchSQL & " [tblprinter].[strprinter] LIKE """ & [Forms]![frmbook]!txtAndPrinter & """ AND"
End If
If IsNull([Forms]![frmbook]!txtAndCity) Then
Else
searchSQL = searchSQL & " [tblcity].[strcity] LIKE """ & [Forms]![frmbook]!txtAndCity & """ AND"
End If
If IsNull([Forms]![frmbook]!TxtAndType) Then
Else
searchSQL = searchSQL & " [tbltype].[strtype] LIKE """ & [Forms]![frmbook]!TxtAndType & """ AND"
End If
If IsNull([Forms]![frmbook]!txtAndDate) Then
Else
Dim txtFrom As String
txtFrom = [Forms]![frmbook]!txtAndDate - 1
If [Forms]![frmbook]!combodateOperator = "between" Then
Dim txtTo As String
txtTo = [Forms]![frmbook]!TxtToDate + 1
searchSQL = searchSQL & "(([qrystringdates].[fromsearch]> " & txtFrom & ") and ([qrystringdates].[tosearch] < " & txtTo & ")) And"
ElseIf [Forms]![frmbook]!combodateOperator = "r" Then
Dim txtR As String
txtR = [Forms]![frmbook]!txtAndDate + 1
searchSQL = searchSQL & " (([qrystringdates].[fromsearch]> " & txtFrom & ") and ([qrystringdates].[tosearch] < " & txtR & ")) And"
Else
Dim txtoperator As String
txtoperator = [Forms]![frmbook]!combodateOperator
searchSQL = searchSQL & " (([qrystringdates].[fromsearch] " & txtoperator & [Forms]![frmbook]!txtAndDate & ")and ([qrystringdates].[fromsearch]>0)) And"
End If
If IsNull([Forms]![frmbook]!txtAndAny) Then
Else
Dim strAny As String
strAny = Forms!frmbook!txtAndAny
searchSQL = searchSQL & " (([tblbook].[lngbookno] Like """ & strAny & """) Or ([tblbook].[strbookname] Like """ & strAny & """) Or ([tblPrinter].[strPrinter] Like """ & strAny & """) Or ([tblcity].[strcity] Like """ & strAny & """) Or ([tbltype].[strType] Like """ & strAny & """) Or ([tblbook].[mmoInfo] Like """ & strAny & """) Or ([tblbook].[lngbookid] Like """ & strAny & """) Or ([tblbook].[mmoAddNotes] Like """ & strAny & """) Or ([tblbook].[strBibliography] Like """ & strAny & """) Or ([tblbook].[strNotes] Like """ & strAny & """) Or ([tblbook].[strSizeMapped] Like """ & strAny & """) Or ([tblbook].[DateStamp] Like """ & strAny & """) Or ([tblbook].[strauthor] Like """ & strAny & """) Or ([tblbook].[strDateInNums] Like """ & strAny & """)) And"
End If
If [Forms]![frmbook]!ChkIncDeleted = True Then
Else
searchSQL = searchSQL & " (([tblbook].[mmoAddNotes] not Like ""deleted*"") Or (isnull([tblbook].[mmoAddNotes]))) AND"
End If
searchSQL = Left(searchSQL, (Len(searchSQL) - 3))
searchSQL = searchSQL & "ORDER BY [tblbook].[lngbookno]"
End If
Thanks for your continued interest
HappyYN