Conditional warning message on opening a record

G

Guest

On certain types of transaction we require prepayment before despatch.
We would like to have a message box popping up when a user opens one of
those transaction forms under circumstances such as these:

* User goes to a certain record (form) by selecting from a combo, form opens
* Value in the TransactionStatus control is "Ready for Despatch"
* Value in the CustomerType control is "Personal"
* Value in the Paid control is "No"
(all of the above conditions to be met, for the message to fire)

We would like to have a popup message box appear, saying something like
"Hang On - we haven't been paid yet!" It doesn't need to block any further
action, it's just a reminder, so can be cleared with a click on OK or
something like that.

I'm sure all this is possible and it's something to do with conditional this
and that, but (as you can possibly tell) I need some help on how to do it!!
As much detail as you can reasonably manage would be great.
Many thanks
CW
 
G

Guest

You just need a little bit of code in the form's Current event procedure:

Const conMESSAGE = "Hang On - we haven't been paid yet!"

If Me.TransactionStatus = "Ready for Despatch" And _
Me.CustomerType = "Personal" And _
Me.Paid = "No" Then
MsgBox conMessage, vbExclamation, "Warning"
End If

A few points to look out for here:

1. The TransactionStatus and/or CustomerType controls might be combo boxes
bound to a numeric foreign key column in the underlying table, but showing
the text data from another column in a referenced (look-up) table, rather
than text columns in the form's underlying table. If so you'd refer to the
control's Column property, e.g. if the text column is the second column of
the combo box's RowSource then you'd use TransactionStatus.Column(1), the
Column property being zero-based.

2. The Paid control could be bound to a Boolean (Yes/No) column formatted
to show as Yes or No rather tan a text column, in which case you'd use
Me.Paid = True.

Ken Sheridan
Stafford, England
 
G

Guest

Why not try conditoinal formatting instead? See help.
IMO, much better solution than msgbox. :)

HTH

Vlado
 

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

Top