Allanmr
Allanmr

Reputation: 13

Insert values from form boxes into last record of table

I have a very large sub routine that opens forms and insert values into text boxes and saves changes. it works, but it inserts these values into random rows and not the newest record on the table. I have also tried a INSERT INTO VALUES query which does the same thing (through VBA and regular SQL query). Is it possible to add these values to the final/first row of the corresponding table? Primary key's are autonumber.

DoCmd.OpenForm "dentalheader", acNormal , , , , acHidden
    Forms!dentalheader!yeartype.Value = "Benefit"
    Forms!dentalheader!term.Value = "80"
    Forms!dentalheader!personmax.Value = "99999"

INSERT INTO dentalheader (each, overallmax, personmax,) 
VALUES (true, '10000', '99999', )

Upvotes: 0

Views: 123

Answers (1)

Gustav
Gustav

Reputation: 55906

Add a datetime field and insert Now:

INSERT INTO dentalheader (timestamp, each, overallmax, personmax) 
VALUES (Now(), true, '10000', '99999' )

Then, for display, sort on timestamp.

Upvotes: 0

Related Questions