ChewDinCompSci
Technical User
I am attempting to send data to a report that is queried by a form where the end user chooses a date and an equipment number. So I'd like to report only on a specific date and equipment number from all my data. I've used the following code for On Click to produce the report:
Private Sub cmdmakereport_Click()
If IsNull([cboRptDate]) Or IsNull([cboRptEquip]) Then
MsgBox "You must enter both a date and equipmentnumber."
DoCmd.GoToControl "cboRptDate"
End If
End Sub
AND... code I've added to the report itself:
Option Compare Database
Option Explicit
Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
Cancel = -1
End Sub
Private Sub Report_Close()
DoCmd.Close acForm, "frmReportGenerator"
End Sub
Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "frmReportGenerator", , , , , acDialog, "rpt_qryByTruck"
If Not IsLoaded("frmReportGenerator") Then
Cancel = True
End If
End Sub
The problem is that nothing happens when I click on the command button cmdmakreport. I have a feeling that I'm missing something simple here but I've had a lot of trouble figuring it out. Any ideas?
Private Sub cmdmakereport_Click()
If IsNull([cboRptDate]) Or IsNull([cboRptEquip]) Then
MsgBox "You must enter both a date and equipmentnumber."
DoCmd.GoToControl "cboRptDate"
End If
End Sub
AND... code I've added to the report itself:
Option Compare Database
Option Explicit
Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
Cancel = -1
End Sub
Private Sub Report_Close()
DoCmd.Close acForm, "frmReportGenerator"
End Sub
Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "frmReportGenerator", , , , , acDialog, "rpt_qryByTruck"
If Not IsLoaded("frmReportGenerator") Then
Cancel = True
End If
End Sub
The problem is that nothing happens when I click on the command button cmdmakreport. I have a feeling that I'm missing something simple here but I've had a lot of trouble figuring it out. Any ideas?