DMax Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have the following code behing a button:

Me.Text464 = DMax("[orderno]", "fy02_basetable", "[orderno] not like 'metr'
and [orderno] not like 'NO#' and [orderno] not like 'shutl' and [orderno] not
like 'local' and [orderno] is not null")

However, for some reason, the [text464] field is still getting a result of
"NO#", despite the following function. What am I doing wrong.

Thanks
geebee
 
When used in conjunction with the Like operator, # is a wildcard character
standing for any digit 0 through 9.

To check to the literal character # in conjunction with the Like operator,
use

not like 'NO[#]'

On the other hand, though, why are you using like at all? None of your
expressions include wildcards!
 
Hello "geebee"

geebee said:
I have the following code behing a button:
Me.Text464 = DMax("[orderno]", "fy02_basetable", _
"[orderno] not like 'metr' and [orderno] not like 'NO#' and " & _
"[orderno] not like 'shutl' and [orderno] not like 'local' and " & _
"[orderno] is not null")

However, for some reason, the [text464] field is still getting a result
of "NO#", despite the following function. What am I doing wrong.

You are using the like operator. The # placeholder means "single digit"
but you ment the # character. Compare with 'NO[#]' instead, or use
"[orderno] is not null and [orderno] not in ('metr', 'NO#', 'shutl',
'local')"
or even better: use that criteria in a query and read the value from a
recordset (D... functions are very slow) - in a new form (how long did
it take to add 465+ controls to the form) with properly named controls,
for example txtMaxOrderNo .;-)
Careful: Does the max of text make sense to you ('z1' > 'a999999999')?
 
Back
Top