Command button to populate field automatically

  • Thread starter Thread starter GillianX
  • Start date Start date
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.
 
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."
 
Back
Top