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 statement not working correctly

Status
Not open for further replies.

benzan

Technical User
Aug 29, 2007
20
US
I have a form where I need to make sure the amount does not exeed it's balance. So I have this if statement but it seems to not work properly.

If Me.txtOEA > Me.txtreserve Then
MsgBox "amount you wish to transfer exeeds the balance"
Me.txtOEA.SetFocus
Exit Sub
End If

txtOEA is the amount user will input and txtreserve has a control of : =Format(Forms!frm_EncLedger!cbobudgetid.column(10),"Currency") 'balance

I've tried the following. I thought problem might be the format or the control property.

I've tried doing...

If Format(Me.txtOEA, "currency") > Me.txtreserve Then
MsgBox "amount you wish to transfer exeeds the balance"
Me.txtOEA.SetFocus
Exit Sub
End If

and I also tried creating a "ghost" text box and set it equal to txtreserve but that didn't work either.

Can anyone help me?
 
I imagine the currency formst is causing the problem in that the value is now presented as text. Try:

Me.txtOEA > Me.cbobudgetid.column(10)

Or

Me.txtOEA > Val(Me.cbobudgetid.column(10))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top