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

Will >= Null Work in VBA code? 1

Status
Not open for further replies.

Stevehewitt

IS-IT--Management
Joined
Jun 7, 2001
Messages
2,075
Location
GB
Hey,

I've the following:

Code:
If Me.DelDate1.Value >= Null Then
Me.NumberLoads.Value = 1
End If

Which also carries on until it reaches number 10. Basically I need it to make the value of a field in the control source query to be set as 1 if DelDate1 has had data entry. If DelDate2 has data entry, then the value is 2 etc...

For some reason it simply isn't working. No error message - nothing. The value of NumberLoads is staying the same. (Null)

Any ideas why? Maybe >= Null doesn't work in VBA code and I'm using it incorrectly.

Can anyone shead some light?!

Thanks,


Steve.
 
You need to use
[blue][tt]
If IsNull(Me.DelDate1.Value) Then
[/tt][/blue]
Your code however will set the value to 1 ... not to 1, 2, 3, ... etc. as your text implies.
 
Hey,

Thanks for the prompt reply. Worked a treat! :-D

Steve.
 
Sorry mate,

How would I set it to greater than Null?

Thanks,

Steve.
 
Hi Steve,

Null means "Does Not Exist".

What does "Greater than Null" mean?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
You can only compare two or more values.
Since null is not a value, any shape or form of comparison with it will fail.

Dimandja
 
Hi Steve,

Something is either Null or Not Null, and you check for it with the IsNull Function, which returns True or False.

If you consider some values to be greater than null (as opposed to simply NOT null) you must, presumably, be considering some other values to be less than null. Which are those? That sounds a bit facetious when I read it back; it's not meant to be. Are you perhaps considering null as zero when you may have both positive and negative other values?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top