Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditions in Macros

Status
Not open for further replies.

Karre

Technical User
Mar 29, 2001
4
US
When I type an condition in a macro in the format of:

forms![form name]![list box 1].Value > forms![form name 2].Value

it doesn't always recognize the true condition. Sometimes it works and sometimes it doesn't. I am doing this for my senior project and my college professor can't even figure out what's wrong!

If anyone has any idea what I'm doing wrong, please let me know. Thanks!
 
Your first mistake is using macros. While macros have their place(extremely limited as that may be) it is not good to use them except in very rare cases where no other method is possible. There are several reasons for this, first and foremost is the lack of error trapping. If an error is generated by a macro it can unexpectedly and catastrophically close your db. All without warning. Another good reason is the decided lack of control afforded by using VBA.

Anyway, your statement is looking for a value generated by the form. You need a CONTROL on the form:

forms![form name]![list box 1].Value > forms![form name 2].ControlName.Value
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top