Autonumber Primary Key

laurat

Registered User.
Local time
Today, 14:21
Joined
Mar 21, 2002
Messages
120
I have a table that has an autonumber as a primary key. Is there a way for that autonumber to only be assigned after all the fields are filled in first?

The problem I am having is users enter in one field (which causes the autonumber to be assigned) and than close the form without filling in the remaining data. Than they come back in with all the info and fill it in. This causes a number to be skipped over and not show in the table because it was assigned when the user entered only one field.

I posted a topic similar to this today but I hoped that this post would make the situation more clear. Any help would be appreciated.
 
Be Patient!

You just posted the earlier post TODAY! And you last post to that was about half an hour before you started this one!:confused:

Give that thread a chance before you go and post it again. :)

Instead of re-posting, you could just add another post to that to have it show up again somewhere near the top of the main forum you posted in (since the forum always shows threads by the most recent post).


Please go back
http://www.access-programmers.co.uk/forums/showthread.php?s=&postid=110144#post110144
 
Sorry I should of added this to the previous post.
 
That's OK... I sometimes don't get an answer to my questions but try not to repost, what I do is to usually add another post to the thread so that it shows up again. Hopefully, you'll get the reponse you're looking for in the original post.
 
Just a thought, I don't know how you're actually performing the addition of the record, but if you're using VBA to open the recordset and then using addnew to update the table could you not check that all information is included before committing to the operation?

e.g. **************

Dim db as Database
Dim rec as Recordset

'textbox/entry items would have to be appropriate to your form
'but the condition here aims to ensure that all items are filled
'prior to updating the table...
If Not IsEmpty(txtBox1) And Not Is Empty(txtBox2) Then

Set db = CurrentDb
Set rec = db.openrecordset("tblTable", dbOpenDynaset)

With rec
.AddNew
'Field names would have to be those in your table
!Data1 = txtBox1.Text
!Data2 = txtBox2.Text
.Update
End With

End If

***************

Or something similar, not totally sure that the checking for empty text boxes in the form is all that you want and you would have to control the initial conditions for the form, but that's how I'd start.

Good Luck
j.
 

Users who are viewing this thread

Back
Top Bottom