Content checking on print preview

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is probably pretty simple but I am new here......

I have a form that has a button that will preview a report based on the
contents of the form. I would like the OnClick event to check for content on
the form and if content is missing terminate the preview and return to the
form.....

if the textbox is called textbox then I think something like this should work

if me.textbox = "" then msgbox "There is insufficient informtion to print"

and then some logic that cancels the print preview and returns to the form...

Thanks in advance....

Greg
 
Actually, in this case you don't need to cancel the print preview. Instead,
you would just never call the print preview, but exit the click routine
first.

Example:
If Nz(Me.Textbox, "") = "" Then 'this will work for "" or Null
Msgbox "You have to fill in textbox!", vbOkOnly + vbExclamation,
"Missing Information"
Me.Textbox.SetFocus
Exit Sub 'this is where you "cancel"
End If
DoCmd.OpenReport "MyReport, acViewPreview
 

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


Back
Top