Dear All,
Any help would really be greatly appreciated![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
I have the following problem:
I have a form - (MainScreen)
This form has several tabs, each relating to a specific selection of tables.
On one of my tabs - (Residential Premises)
I have a list box which lists reports
Then on the right hand side of this list there are fields to be filled in:
Screen Name : Form Name
Start Date : RpStartDate (Date chooser ActiveX)
End Date : RpEndDate (Date chooser ActiveX)
Officer : RpCmbOfficer (Combo box)
Type : RpCmbTyp (Combo Box)
I have made the controls for certain fields disappear when a specific report is selected.
I now want a message box to appear, if they have not entered a mandatory field, i.e. SrStartDate
I have the following code on my generate report button:
It gives me an error when I don't enter the date but doesn't give me the message box I want, instead it gives me an error message:
![[banghead] [banghead] [banghead]](/data/assets/smilies/banghead.gif)
Where am I going wrong?
Please help, it will be much appreciated.
Kind regards
Triacona
Any help would really be greatly appreciated
![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
I have the following problem:
I have a form - (MainScreen)
This form has several tabs, each relating to a specific selection of tables.
On one of my tabs - (Residential Premises)
I have a list box which lists reports
Code:
"RP Report Via Open Cases";"RP Report on Type for Open Cases";"RP Report Open Cases Via Officer";"RP Report Case Via Officer";"RP Report Via Officer and Action Date";"RP Hazards Sorted via Rating";"RP Hazards Sorted Via Officer"
Then on the right hand side of this list there are fields to be filled in:
Screen Name : Form Name
Start Date : RpStartDate (Date chooser ActiveX)
End Date : RpEndDate (Date chooser ActiveX)
Officer : RpCmbOfficer (Combo box)
Type : RpCmbTyp (Combo Box)
I have made the controls for certain fields disappear when a specific report is selected.
I now want a message box to appear, if they have not entered a mandatory field, i.e. SrStartDate
I have the following code on my generate report button:
Code:
Private Sub Rp_Report_Click()
On Error GoTo Err_Rp_Report_Click
Dim stDocName As String
'Dim Description As String
'Description = "Please Enter Dates"
stDocName = ListRP
Dim ErrMsgED As String
Dim ErrMsgND As String
ErrMsgND = "There is no Date for This Report"
ErrMsgED = "Please Enter Date"
Select Case ListRP.ItemData(ListRP.ListIndex)
Case "RP Report Via Open Cases", "RP Report on Type for Open Cases", "RP Report Open Cases Via Officer"
If SrStartDate Is Not Null Then
MsgBox (ErrMsgND)
End If
Case "RP Report Case Via Officer", "RP Report Via Officer and Action Date", "RP Hazards Sorted via Rating", "RP Hazards Sorted Via Officer"
If SrStartDate Is Null Then
MsgBox (ErrMsgED)
End If
End Select
DoCmd.OpenReport stDocName, acPreview
Exit_Rp_Report_Click:
Exit Sub
Err_Rp_Report_Click:
MsgBox Err.Description
Resume Exit_Rp_Report_Click
End Sub
It gives me an error when I don't enter the date but doesn't give me the message box I want, instead it gives me an error message:
Object required
![[banghead] [banghead] [banghead]](/data/assets/smilies/banghead.gif)
Where am I going wrong?
Please help, it will be much appreciated.
Kind regards
Triacona