Re: Update a table using a form



On Tue, 29 Nov 2005 06:21:12 -0800, "WGordon"
<WGordon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>Thanks for the info. I have the properties set as you advised. The problem
>is, when you open the form the "reference number" (Auto number of the record)
>always goes to record 1 and you cannot type anything in this field. You can
>use the "next record" or "Last record" controls at the bottom of the form.
>I'm trying to eleminate this step because if you forget to go to the last
>record you will update the first record by mistake..

You're misunderstanding how forms work, it seems. The "Reference
Number" isn't "going to 1". The Form is a window, which displays the
data in the table; if you don't do something otherwise, it simply is
displaying the first record in the Form's recordsource.

If you want to ALWAYS go to the new, empty record to enter new data,
set the Form's DataEntry property to True. This has the disadvantage
that you cannot review or edit existing records.

If you want to do both, you'll need just a line of VBA code. Open the
Form in design view; view its Properties; select the Event tab, and
find the Open event. Click the ... icon by this event and choose "Code
Builder". Access will give you a Sub and End Sub line; edit it to

Private Sub Form_Open(Cancel as Integer) <<< Access gives you this
DoCmd.GoToRecord acNewRecord
End Sub

This will move the "window" to the new record when you open the form,
but you'll still be able to use the navigation buttons to view and
edit other records if you wish.

John W. Vinson[MVP]
.