C
croth68 via AccessMonster.com
I have a form that allows me to search my table using a number of key words,
I also included a button where I could take the search results and put them
in a report format for easy printing. Initially the date would not print so I
added this code strCriteria = "[Date Out] Between # " & Me![Text48] & " # And
# " & Me![Text50] & "#" courtesy of another user. It works fine if the date
field is filled in, however if the date field is not filled in I get a
runtime error 3075 with the DoCmd.OpenReport strReportName, acViewPreview, ,
strCriteria highlighted. Any help you can provide is greatly appreciated.
Thanks
Private Sub Command61_Click()
Dim strReportName As String
Dim strCriteria As String
If NewRecord Then
MsgBox "This record contains no data." _
, vbInformation, "Invalid Action"
Exit Sub
Else
strReportName = "Table1"
strCriteria = "[Record Number]= " & Me![Record Number]
strCriteria = "[Date Out] Between # " & Me![Text48] & " # And # " &
Me![Text50] & "#"
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End If
End Sub
I also included a button where I could take the search results and put them
in a report format for easy printing. Initially the date would not print so I
added this code strCriteria = "[Date Out] Between # " & Me![Text48] & " # And
# " & Me![Text50] & "#" courtesy of another user. It works fine if the date
field is filled in, however if the date field is not filled in I get a
runtime error 3075 with the DoCmd.OpenReport strReportName, acViewPreview, ,
strCriteria highlighted. Any help you can provide is greatly appreciated.
Thanks
Private Sub Command61_Click()
Dim strReportName As String
Dim strCriteria As String
If NewRecord Then
MsgBox "This record contains no data." _
, vbInformation, "Invalid Action"
Exit Sub
Else
strReportName = "Table1"
strCriteria = "[Record Number]= " & Me![Record Number]
strCriteria = "[Date Out] Between # " & Me![Text48] & " # And # " &
Me![Text50] & "#"
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End If
End Sub