Command button to populate field automatically

G

GillianX

Hi,

I would like a command button on my switchboard to open a form and
automatically populate a field with the next available number.

The field is called "Client_Number" and the format is QN5001, QN5002, QN5003
etc. Therefore, when a user clicks the command button, in this instance, I
would like the "Client_Number" field populated with QN5004.

Is there a way to do this?

Thanking you in advance.
 
A

Al Campagna

Gillian,
An easier method would be to have a numeric field for just the number
portion, and another field to hold the final value. (ex. [Counter] and
[TransID])
Use the Dmax Counter +1 to get the number, and concatenate a "QN" onto
it, and store in TransID.
ex. (use your object names)
TransID ="QN" & NZ(DMax("[Counter]","tblYourTable")) +1
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

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

Top