increment number field

  • Thread starter Thread starter cvb
  • Start date Start date
C

cvb

I need to increment a number field in a table that will
work like auto number but I have data that was migrated
from Lotus Approach so I can not use auto number. Does
anyone have a routine to do this? I also have a problem
pre populating a field and get ENTER PARAMETER VALUE the
error is (can't find value asked for input)
 
I need to increment a number field in a table that will
work like auto number but I have data that was migrated
from Lotus Approach so I can not use auto number. Does
anyone have a routine to do this?

If you do your data entry in a table datasheet... don't; the table has
no usable events. Instead use a Form. In its BeforeInsert event put
code like

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtID = NZ(DMax("[ID]", "[your-table-name]")) + 1
End Sub
I also have a problem
pre populating a field and get ENTER PARAMETER VALUE the
error is (can't find value asked for input)

Please post your code.
 
I need to increment a number field in a table that will
work like auto number but I have data that was migrated
from Lotus Approach so I can not use auto number.

Yes you can. You can append records into a table and preserve any values
that go into an autonumber field (allowing, of course for key violations).
This works just fine, for example

INSERT INTO MyTable (MyAutonumber)
VALUES (1022);

and you can do the same by inserting a set of records from another SELECT
query. The autonumber seed will be set to the next highest number (unless
that is lower that whatever it already was, if you see what I mean).

Hope that helps


Tim F
 
Back
Top