N
neenmarie
I'm trying to use the following code with a button on a form to open a
report. If the user has not selected or filled in fields on the form, I'd
like a message box to remind them. Only if they've selected 1 item and
filled in 2 dates should the report open. My code appears to do nothing at
all. Pls help with my code. Here's my bad code:
*************************
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
Dim stDocName As String
If ([Team1] Is Null) Then
MsgBox "You must select a Team"
ElseIf ([BegDate] Is Null) Then
MsgBox "You must enter a Beginning Date"
ElseIf ([EndDate] Is Null) Then
MsgBox "You must enter an Ending Date"
End If
stDocName = "rptTeamActivity"
DoCmd.OpenReport stDocName, acPreview
Exit_Command35_Click:
Exit Sub
Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click
**********************************
report. If the user has not selected or filled in fields on the form, I'd
like a message box to remind them. Only if they've selected 1 item and
filled in 2 dates should the report open. My code appears to do nothing at
all. Pls help with my code. Here's my bad code:
*************************
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
Dim stDocName As String
If ([Team1] Is Null) Then
MsgBox "You must select a Team"
ElseIf ([BegDate] Is Null) Then
MsgBox "You must enter a Beginning Date"
ElseIf ([EndDate] Is Null) Then
MsgBox "You must enter an Ending Date"
End If
stDocName = "rptTeamActivity"
DoCmd.OpenReport stDocName, acPreview
Exit_Command35_Click:
Exit Sub
Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click
**********************************