How do I set up a unique number?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi There,

I am setting up a basic Data Licence database. For each new record I enter
I want a unique number to appear at the top of my form that can not be
changed. I would like the number to be the date it is entered plus the auto
number so, YYMMDD-(auto number) eg 071001-1. I'm sure it's something simple
but I am only new to access.

I would really appreciate any help!

Thank you,
Dane
 
Unless something has changed in the newest version, you need to type
something in your form you dirty it.

Then add something like this to the Dirty event on your form:

Private Sub Form_Dirty(Cancel As Integer)
txtMyData = Format(Date(),"yymmdd") & "-" & Me.txtID
End Sub

where txtMyData is the name of the textbox which holds your number field
from the table, and txtID is the name of the textbox that holds your
autonumber field. Lock the txtMyData textbox so that no one can fiddle with
it. (Code doesn't care if you lock the interface).
 

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


Back
Top