Msg box help

C

Chad

Hello, I have this event on a button on my form. I have a cboReport combo box
that gives a list of my reports and when I select the report I want to
preview from the list I click the cmd button to view it. How would I add a
message box to display if there isnt anything selected in the cboReport cobmo
box? Thanks!

Private Sub cmdReport_Click()

Dim strDocName As String

Let strDocName = Me![cboReport]

DoCmd.OpenReport strDocName, acPreview

End Sub
 
D

Daniel

You could try something like

Private Sub cmdReport_Click()

Dim strDocName As String

If isnull( Me![cboReport]) Then
Msgbox "Please make a selection and try again", vbinformation,"No
report selected"
Else
strDocName = Me![cboReport]
DoCmd.OpenReport strDocName, acPreview
End if
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top