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!

Is Not

Status
Not open for further replies.

pooterpooter

Technical User
Oct 7, 2005
11
BG



I have the folloiwng working code :


If IsNull(Me!Quantity) And Me!cartons = 0 And Me.Parent!Customerid <> 123


I want to add on the following condition, meaning that it will be valid only when the the button Command580 is not pressed :

And Is Not Null Me.Parent!Command580 Then

But my line does not succeeed, and i get an eror. Where is my fault?



If IsNull(Me!Quantity) And Me!cartons = 0 And Me.Parent!Customerid <> 123 And Is Not Null Me.Parent!Command580 Then

 
A command button does not have a "pressed/not pressed" value. Clicking (or double clicking) a button triggers the OnClick (OnDblClick).

Is this "button" part of an option group?

Where are you calling your code from?
 
the button is placed in the main form.I am calling the code from the main form.

regards
 
Are you calling it when the form opens, or when a user performs some action in that form?
 
If the button is on the main form, then you can use just Me!Command580. By the name i am guessing it is a command button, so you will have to capture the On_Click event of the button. You can do something like this

Dim bButtonClick as boolean

bButtonClick=False

In the On_Click event
Private Sub Command580_OnClick
bButtonClick=True
End Sub

i.e. the boolean variable is set to true if the button is pressed. You can use this boolean variable in your If condition. So, if its false, that means the button is not pressed, and do whatever you want....

Hope this helps
 
If the button is part of an OptionGroup then test the Frame value.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top