Default to Last Record?

  • Thread starter Thread starter njkear
  • Start date Start date
N

njkear

Guest
I am building a form for users to add multiple records to the table or database. I am trying to create a form that allows the user to only change one field on the form (for example just the inventory number) and leave the others the same. However, the way I have the form setup now, it either overwrites the current record, or if the user tries to go to another record, it blanks out the rest of the fields. I was thinking of trying to make the default field values become whatever is in the last record, because users many times are entering the same info. in many of these fields. I havn't figured out how to do this or if this is really the best method to achieve this. Any help would be appreciated.

Thanks,
njkear
 
N,

To make your form automatically go to the last record when it is first opened, you can add a line of code to the form's Open Event.

Private Sub Form_Open(Cancel As Integer)

DoCmd.GoToRecord , , acLast

End Sub

To prevent users from changing data to a control, set the locked property of the control to yes.

Regards,
T
 
If there are only a few fields to copy, the user can use CNTL-' to copy the value from the previous record.

pono1, the statement you suggested will go to the last physical row in the recordset which may or may not be the last physical record in the table and may or may not be the last record entered in the table. When a db is compacted, Access rewrites every table into primary key sequence. Tables are never actually accessed directly. A recordset is produced behind the scenes by Access either by running the form's recordsource query or by running one that Access creates to extract data from the table. Recordsets are unordered sets and will only have a predetermined order if they are made from a query that includes an order by clause that sorts on a unique id or group of columns that form a unique id.
 

Users who are viewing this thread

Back
Top Bottom