Message box and beeps

  • Thread starter Thread starter jward
  • Start date Start date
J

jward

In Access 2002 I have created a form for data input into
a table. When the user enters the data for the Audit
field it checks to see if that date is prior to the Event
Date. If it is it displays a Message Box containing a
warning. I want it to also beep when that occurs. Here
is the command created thru Expression Builder. Any help
is appreciated.

=IIf(Format([EventDate],"mm")>[AuditPeriod],MsgBox
("WARNING! Audit Period is prior to Event Date"))
 
jward,

This is unusual. Where are you putting the expression you gave us.
Normally, this proces would be done in a macro or in a vba procedure.
If it was in a macro. you would use the bit:
Format([EventDate],"mm")>[AuditPeriod]
.... in the Condition of the macro. And then, you would use a Beep
macro action as well as the MsgBox macro.

By the way, it looks to me that Format([EventDate],"mm")>[AuditPeriod]
is unlikely to give you what you want anyway. This would assume that
AuditPeriod is a text field which only contains month information in a
"mm" format, is that correct? If so, what about when the AuditPeriod
is 01 and the EventDate is in December... your message box will pop up
because 01<12 when in fact the data is probably correct?

- Steve Schapel, Microsoft Access MVP
 
Back
Top