I sure hope someone can help me with this. On the Open event of the Report I ask the user for a beginning date and an ending date to filter the data on as follows:
Private Sub Report_Open(Cancel As Integer)
Dim strFltr As String
GStrapEd = InputBox("Please enter start date below:"
If GStrappED() = "" Then
Cancel = True
Else
GStrapIng = InputBox("Please enter end date below:"
If GStrappING() = "" Then
GStrapIng = GStrappED()
End If
strFltr = "(qry_po_log_rpt.dateordered Between #" & GStrappED() & _
"# AND #" & GStrappING() & "#)"
Filter = strFltr
FilterOn = True
End If
End Sub
The GstrappED and GStrappING are defined in my global module so that I can use these values later. Their functions are as follows:
Public GStrapEd As String
Public GStrapIng As String
Public Function GStrappING() As String
GStrappING = GStrapIng
End Function
Public Function GStrappED() As String
GStrappED = GStrapEd
End Function
The problem comes when I get a report with no data. I want the user to be able to enter new dates if they receive no data the first time around. So far I have come up with the following:
Private Sub Report_NoData(Cancel As Integer)
Dim strTemp As Long
strTemp = MsgBox("There are no invoices for this period" & vbCrLf & Chr(13) & _
"Would you like to try a different set of dates?", vbYesNo, "no data"
If strTemp = 6 Then
Filter = ""
FilterOn = False
Report_Open (0)
Else
Cancel = True
End If
End Sub
I can't seem to get this to work. It just continues to ask if you would like different dates. Please let me know what you think.
Private Sub Report_Open(Cancel As Integer)
Dim strFltr As String
GStrapEd = InputBox("Please enter start date below:"
If GStrappED() = "" Then
Cancel = True
Else
GStrapIng = InputBox("Please enter end date below:"
If GStrappING() = "" Then
GStrapIng = GStrappED()
End If
strFltr = "(qry_po_log_rpt.dateordered Between #" & GStrappED() & _
"# AND #" & GStrappING() & "#)"
Filter = strFltr
FilterOn = True
End If
End Sub
The GstrappED and GStrappING are defined in my global module so that I can use these values later. Their functions are as follows:
Public GStrapEd As String
Public GStrapIng As String
Public Function GStrappING() As String
GStrappING = GStrapIng
End Function
Public Function GStrappED() As String
GStrappED = GStrapEd
End Function
The problem comes when I get a report with no data. I want the user to be able to enter new dates if they receive no data the first time around. So far I have come up with the following:
Private Sub Report_NoData(Cancel As Integer)
Dim strTemp As Long
strTemp = MsgBox("There are no invoices for this period" & vbCrLf & Chr(13) & _
"Would you like to try a different set of dates?", vbYesNo, "no data"
If strTemp = 6 Then
Filter = ""
FilterOn = False
Report_Open (0)
Else
Cancel = True
End If
End Sub
I can't seem to get this to work. It just continues to ask if you would like different dates. Please let me know what you think.