coding question

intrep11

Registered User.
Local time
Today, 05:05
Joined
Apr 6, 2003
Messages
63
please can someone look at this and tell me why i am not getting the 001 that i want when there is not entry matching the query


code in the onload section of page

'generate the message no fom a query +1
If DMax("[IDLocal]", "[tblSentEmail]", "[tblSentEmail]![Ship]=Forms![frmMessaggeType]![Combo23]") = Null Or DMax("[IDLocal]", "[tblSentEmail]", "[tblSentEmail]![Ship]=Forms![frmMessaggeType]![Combo23]") = "" Then
Me.IDLocal = "001"
Else
IDLocal = DMax("[IDLocal]", "[tblSentEmail]", "[tblSentEmail]![Ship]=Forms![frmMessaggeType]![Combo23]") + 1
End If


if there is a number in the tblsentemail it works and increments by one if there isnt an entry all i get is a blank box. even though checking the immediate window i get null.
 
If isnull(DMax("[IDLocal]", "[tblSentEmail]", " [tblSentEmail]![Ship]=Forms![frmMessaggeType]![Com
bo23]")) Or DMax("[IDLocal]", "[tblSentEmail]", " [tblSentEmail]![Ship]=Forms![frmMessaggeType]![Com
bo23]") = "" Then
Me.IDLocal = "001"
Else
IDLocal = DMax("[IDLocal]", "[tblSentEmail]", " [tblSentEmail]![Ship]=Forms![frmMessaggeType]![Com
bo23]") + 1
End If

Note the isnull(expression) rather than = null

HTH
John:)
 
thanks a million

thank a million that did the trick seems a bit odd as i thought they were the same but i can live with ti now i know

cheers for your help
ND
 

Users who are viewing this thread

Back
Top Bottom