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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if value is equal to or greater than 3 then...

Status
Not open for further replies.

jonra

Programmer
Jul 20, 2003
42
SG
when a textbox value is equal or greater than 3 i wan to open a form...how can i do it?thanks...
 
Here is sample VBA code:
If Me![ControlName] => 3 then
DoCmd.OpenForm "frmFormName"
End If

Where you put this code is up to you. Possibile in the OnClick Event procedure of a Command Button. Just update the red code above with your textbox name and the form name to make it work for your situation.

Post back with additional questions.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
hi Bob

the value in the textbox is auto calulated thru number of records in the subform..

i tried after update and on dirty but could not work..

actually wat i wan is..if textbox value is equal or greater than 3 then i wan to popup a reminder..is there a better way to do it?..

Jo
 
I would try Bob's code in the On Current event of the Main/Parent form.

If you want to give a warning look at help on the MsgBox function.

Bill
 
i got a problem onli when the value is equal to 3 then the msgbox will appear,value greater than 3 does not make the msgbox appear...wat is wrong wif my code?...

If Me![Text21] >= 3 Then
MsgBox "xxx"
End If

 
Jonra = you've got the > and the = flipped around (at least in your example). It should be

if Something => 3 not
if something >= 3

However, that may not be your actual problem. If I read your second post correctly, this is a calculated value.

In other words, you're calculating something, and stick the result in Text21, right?

Why not just do the MsgBox thingy in the calculation Process:

foo = x+y/z * 137 or whatever

if foo => 3 then
msgbox "Foo is equal or greater than 3"
end if


Me.text21 = foo


See? Why wait to check on something that's being stuck into a text box AFTER you stick it in the text box? Why not check it as soon as you create it?




If at first you don't succeed, skydiving probably isn't for you!
Another free Access forum:
More Access stuff at
 
the value is created in a subform countin the number of records..then show in main form...at the subform footer i put a textfield which count the records wif count(*)..then i show it in the textfield in main form...how can i do it...i try to count it in the subform but its still the same n it oso show the msgbox thrice...when i try to count it in the main form it could not work...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top