How to display a message next to a text box field when the field value is over 50?

access_uk

Registered User.
Local time
Today, 09:07
Joined
Mar 12, 2010
Messages
11
Hi


I have a form where there is a field called Price. I need to display a message "Price is too high" next to this field only when the Price field is over $1500.

How to do that?

Any help is greatly appreciated.

Thanks
 
Welcome to AWF!:)

Maybe you could use CONDITIONAL FORMATTING instead? That way you could turn the forecolor of the text box to red if it's over that value and switch it back to default if it doesn't meet that criteria. Sounds like a good idea?

What version of Access are you running?
 
Sounds great, but how do I do that? Sorry, I am fairly new to Access.

I am using Access 2007.

Many Thanks for your help.
 
Look at "DemoOver50A2000.mdb" (attachment, zip).
Open Form and try.
 

Attachments

Thanks, but I actually want to display a message next to the Price field when it is greater than 1000. When is less than 1000, then no message is displayed.

So it would look like this:


Price: 1000
Price: 1250 - price is too high

The conditional formatting only allows me to change the background colour of the field I am testing.

Thanks
 
There are actually 2 colour settings. One for the backcolor and the other for the forecolor (or if you like, text color)
 
Ok, I got it. But how about the message being displayed right next to the Price field when the Price field value is over 1000?

How do I do that?
 
You would need to learn some basic VBA to achieve that. At least what events are, where to place code, IF... ELSE statement etc.

OR

Use the Control Source property of the text box and investigate how to use the IIF() function.
 
I know programming and how the IF statement works. I just don't know to set up this in Access so I can view the message when the field value is over something.

Thanks for your help
 
The second option is your best bet. Did you have a look at the IIF() function? You know what the Control Source of a text box is?
 
you could have a label saying "Value too high", set as visible = false

now, in the current event for the form

put the code

warninglabel.visble = checkfield > 1000

(changing the references to suit)

this will make the label visible, if the field you are checking meets certain conditions
 
Fantastic. It works when I put the code in Form_Current()

Thanks all for the tips. :)
 

Users who are viewing this thread

Back
Top Bottom