Syntax and DMax issue

  • Thread starter Access Greenhorn
  • Start date
A

Access Greenhorn

I have a field comprised of serial nos. For those rare equipment items that
do not have a serial number, they are assigned the following artificial
serial number: NoSerial#. I would like there to be an unbound object that
displays the last artificial serial number assigned so that the user knows
what the next sequential number is. I figure the simplest way to do this is
by using the DMax function in the control source of the text object.

If I do the code below, it works fine and returns the value "NoSerial1"
But how do I write it so the it returns the max value of the criteria LIKE
"NoSerial*", or can I?

=DMax("[SerialNo]","tblEquipment","[SerialNo] = 'NoSerial1' ")

Thanks,
AG
 
A

Access Greenhorn

I tried that, it didn't work for some reason.

Douglas J. Steele said:
=DMax("[SerialNo]","tblEquipment","[SerialNo] Like 'NoSerial*' ")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Access Greenhorn said:
I have a field comprised of serial nos. For those rare equipment items
that
do not have a serial number, they are assigned the following artificial
serial number: NoSerial#. I would like there to be an unbound object that
displays the last artificial serial number assigned so that the user knows
what the next sequential number is. I figure the simplest way to do this
is
by using the DMax function in the control source of the text object.

If I do the code below, it works fine and returns the value "NoSerial1"
But how do I write it so the it returns the max value of the criteria LIKE
"NoSerial*", or can I?

=DMax("[SerialNo]","tblEquipment","[SerialNo] = 'NoSerial1' ")

Thanks,
AG
 
D

Douglas J. Steele

What does "didn't work" mean in this context? You got an error? If so, what
was the error? You didn't get an error, but you didn't get the answer you
expected? What answer did you get, and what did you expect to get?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Access Greenhorn said:
I tried that, it didn't work for some reason.

Douglas J. Steele said:
=DMax("[SerialNo]","tblEquipment","[SerialNo] Like 'NoSerial*' ")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Access Greenhorn said:
I have a field comprised of serial nos. For those rare equipment items
that
do not have a serial number, they are assigned the following artificial
serial number: NoSerial#. I would like there to be an unbound object
that
displays the last artificial serial number assigned so that the user
knows
what the next sequential number is. I figure the simplest way to do
this
is
by using the DMax function in the control source of the text object.

If I do the code below, it works fine and returns the value "NoSerial1"
But how do I write it so the it returns the max value of the criteria
LIKE
"NoSerial*", or can I?

=DMax("[SerialNo]","tblEquipment","[SerialNo] = 'NoSerial1' ")

Thanks,
AG
 
Top