Overwrite first row in a table

  • Thread starter Thread starter The Mexican
  • Start date Start date
T

The Mexican

Hi, I am using a form and have a field that displays a serial number from a
table called serial.
as i move to the next page on the form i am trying to get the number,
increment it and update the previous serial number in the table to the new
value without creating anoter row in the table.

i hope i explained that properly!!!
 
The Mexican,
use an update query.
An update query will change the value in the field and row you specify
without adding a new row in the table.
You can use DLookup on the table to get the current value, then add 1 to it
and use the new value in your update query.
If you are using this serial number in place of a primary key, then it may
be more involved than just the simple steps outlined above.


Jeanette Cunningham -- Melbourne Victoria Australia
 
Thanks Alot, that works really well!

for anyone who wants to do the same, here is the code:

Private Sub Form_Current()
Dim code
code = DFirst("[serial]", "serial")
Me.SerialNumber = code
DoCmd.OpenQuery "SerialQuery", , acReadOnly
End Sub

and for my update query i put: [Serial]+1 in the update field


Thanks Jeanette!
 
Back
Top