Need Help

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

Guest

I created a datbase and forms. On the form i have to have a number field
called ceertificate number. This number is used to identify each record
created. It is currently an autonumber field. I would like to have this field
generate a new number by using a button, which will insert the number into
that field. Is there a way to do this?
 
I think this will work...

Private Sub CommandButton_Click()
Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset(TableName, dbOpenSnapshot)

rs.MoveLast
Me.CertificateNumber.Value = rs.RecordCount + 1

Set rs = Nothing

End Sub

But AutoNumber does this anyway....
This is an oversimplification and would give a problem if the recordset was
empty to start but you should get the idea.

doco
 

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

Back
Top