you dont get the # until the record is saved, so ....
make that box the first in the list (with tab stop = no)
add an unbound box as the last box, and make it transparent ,without borders. Its not for entry, but a place for the cursor to land when done to trigger the save.
save the record using the txtLastBox_OnGotFocus event. DoCmd.RunCommand acCmdSaveRecord
NOW the record # should show
For fields with Autonumber type, the number is assigned as soon as the record is created, which happens as soon as the user enters any data (i.e. a character) into the record and before it is saved.you dont get the # until the record is saved, so ....
As ranman suggested, just put a text box bound to the record number (i.e. the autonumber field) at the beginning of each line, and Access will fill it in for you.
Note: if you depend on having all the record numbers present and in sequence, don't use autonumber. The generated autonumber is not reused, even if you don't save the record.
What do you need to do with that number? Do you need to save it to another field or you just want it displayed before the record is saved?
Turns out I don't need the newly created ID (autonumber) of new record, I just need the record saved so that it becomes the current record. Below is the event code:
Thanks for everyone's thoughts,Code:Private Sub tbShadow_GotFocus() '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* ' The "Shadow" text box is a transparent "sliver" just to the right of SubCatName ' text box. It gets the focus when the user presses enter after having entered an ' additional sub-category name. The ID of the major category is inserted in the ' table field to satisfy the relational link, having done that the record can be ' saved. '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* On Error GoTo SubCatErr Me.SubCatOfID = ID 'Set link to Major category (ID captured at Open time) DoCmd.RunCommand acCmdSaveRecord Exit_Handler: Exit Sub SubCatErr: MsgBox "Error " & Err.Number & " - " & Err.Description Resume Exit_Handler End Sub
Bill
(PS) Does ranman256 really look like Arnold