Get serial number from previous record

G

Guest

I am using Access 2002. I have a form, "Main", which includes the text box
"SN". I have about 10 auditors who use this form to enter data. During most
days, each auditor enters the serial number of the part they are checking
during each one of their 8 inspections. The auditors are checking different
parts, so they enter different serial numbers than the other auditors. They
are getting tired of always having to re-enter the same serial number (SN).

I want to be able to:
1.) open the form to a blank record
2.) enter the serial number for a new record
3.) have my next record have the same serial number as the previous record
if the form has not been closed

Setting the serial number to a default is not a good option because,
although they enter the same serial number into a record about 8 times a day,
the serial number they are entering changes every day in a way that is not
predictable.

My concerns are avoiding duplicate records and not having the serial number
appear the next time I open the form. Also, I am not sure if I can do this
if multiple people are entering data at the same time.

Does anyone know how I might go about doing this or if there is a better way?

Thank you
 
M

Michel Walsh

Hi,


In the after update event of the FORM, or where appropriate, have something
like:


Me.SerialNumber.DefaultValue = """" & Me.SerialNumber & """"


That does NOT change the default value OF THE TABLE, it just change the
default value of THE CONTROL: Me refers to the form, not the table, so
Me.SerialNumber is the control in the form, not the field in the table. Next
time you will open the form, the CONTROL default value will be set to a copy
of the default value of the FIELD (which is null, from what I understand)
and the proposed code will change it only once one record would have been
saved (or otherwise saw the proposed line of code).



Hoping it may help,
Vanderghast, Access MVP
 

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