Open Form using IF Statement Not working (1 Viewer)

weilerdo

Registered User.
Local time
Today, 01:35
Joined
Apr 21, 2005
Messages
109
Hi All, I hope someone can help me figure this one out. I have a Form frm_inventory which is based on a query which is based on a single table. On the form I have a field Text86 which is unbound that shows me the totals(sum) of a number field in another table. All of this works great, my problem is on the form I have a button that I need the user to click on if they need to order an item. On the button I have the following code which should be checking to see if the qty on hand is less then the minimum qty to order.

Private Sub Command89_Click()
If Me.Text86.Value <= Me.Text84.Value Then
MsgBox "Please check the Qty on Hand Before trying to order more.", vbInformation, "Order Rejected"
Exit Sub
End If
DoCmd.OpenForm "frm_grain_wk", acNormal
End Sub


If there is any value other then Null in Text86 I get the Msgbox:confused:
 

maxmangion

AWF VIP
Local time
Today, 06:35
Joined
Feb 26, 2003
Messages
2,805
Hi,

are you sure that the datatypes of your fields are set to store numbers and not text? I would suggest you use the Val function in order to make sure that you are comparing numbers and not text.
 

weilerdo

Registered User.
Local time
Today, 01:35
Joined
Apr 21, 2005
Messages
109
Yes I am 100% sure that both fields are numbers. I beleive it was something to do with Text86 is not bound to the form. It is a field that displays the results of a seperate query.
 

weilerdo

Registered User.
Local time
Today, 01:35
Joined
Apr 21, 2005
Messages
109
Hey maxmangion

Thanks for the help I figured it out. It was a formatting issue with the type of number I was using.
 

maxmangion

AWF VIP
Local time
Today, 06:35
Joined
Feb 26, 2003
Messages
2,805
I'm glad to hear that you managed to sort out the problem weilerdo :)
 

Users who are viewing this thread

Top Bottom