Syntax and DMax issue

G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Using Max or DMax in DLookUp criteria? 1
Using subform's recordset in DMax call? 6
DMax 2
DMax on Text Field 1
Max or DMax - Issue 8
DMAX() - Text Field Issue 2
What is hapening? 7
Dmax syntax 2

Top