D
DubboPete
Hi all,
I have a reports menu (form), where one of the command buttons opens up a
"Staff Profile" report.
I have put in a trap whereby this happens:
Private Sub butStaffDetails_Click()
If (Me.StaffMember = "") Then
' field [staffmember] is a combo box and is text
MsgBox "Select staff member before trying to view profile",
vbInformation
Me.StaffMember.SetFocus
Exit Sub
Else
DoCmd.OpenReport "rptReportStaffDetails", acViewPreview
End If
End Sub
At present, and where (Me.StaffMember = ""), the code exits; a staff member
is selected, then the command button has to be clicked again to open the
report without errors....
I'm sure there would be a way to pause the code at some point, probably
before the 'exit sub' line, to set the focus back on the [staffmember]
field, wait until a selection is made, and then after that update, resume
the opening of the report.... without having to re-click the command button
a second time.
Am I right, and can someone help fill in the gaps in the code for me?
thanks in anticipation
DubboPete
I have a reports menu (form), where one of the command buttons opens up a
"Staff Profile" report.
I have put in a trap whereby this happens:
Private Sub butStaffDetails_Click()
If (Me.StaffMember = "") Then
' field [staffmember] is a combo box and is text
MsgBox "Select staff member before trying to view profile",
vbInformation
Me.StaffMember.SetFocus
Exit Sub
Else
DoCmd.OpenReport "rptReportStaffDetails", acViewPreview
End If
End Sub
At present, and where (Me.StaffMember = ""), the code exits; a staff member
is selected, then the command button has to be clicked again to open the
report without errors....
I'm sure there would be a way to pause the code at some point, probably
before the 'exit sub' line, to set the focus back on the [staffmember]
field, wait until a selection is made, and then after that update, resume
the opening of the report.... without having to re-click the command button
a second time.
Am I right, and can someone help fill in the gaps in the code for me?
thanks in anticipation
DubboPete