open report from lost focus in a form

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

Guest

I have a form used as a menu. Most reports on this menu have buttons to open
them. There is a text box on the form that the user enters a date into. All
the queries for these reports refer to this text box to filter records.

After entering the date in the text box, I'd like a report to open
automatically to warn the user if there is more than one price showing active
that needs to be corrected before opening the other reports.

I tried to use the lost focus command for the text box as follows, but am
not putting it in correctly....

DoCmd.OpenReport "BOMMultiplePricing" , acViewNormal , ,

I've tried more and less commas, parenthesis, brackets....can't figure out
what I'm doing wrong. Pls Help.
 
Neenmarie

If you are just talking about the syntax of the code, it would simply be...
DoCmd.OpenReport "BOMMultiplePricing"

I am not sure whether this is what you were asking, or whether you want
to know how to have this report print only if there is more than one
active price. If this is what you want, I would make a query that
returns the records with price showing active, and then put code like
this...

If DCount("*","ActivePriceQuery")>1 Then
DoCmd.OpenReport "BOMMultiplePricing"
End If

I would prefer to use the After Update event of the textbox, rather than
the Lost Focus event.
 
Thank you. I copied and pasted your code and it worked except it printed. I
added a comma and the preview mode and it works fine. Thanks again for your
help.
 
Back
Top