Insert date into a specific cell in a table

Frank123

Registered User.
Local time
Today, 04:40
Joined
Jun 29, 2016
Messages
31
Hi,

I need some help. I'm using Access 2010, and I am looking for vba code that will insert a date that is entered in a pop up form into a specific cell in a table in the db. Specifially, I would like to have the date inserted in the the field entitled "Accumulation Date" in the table, but in row 5. I tried the INSERT command but it appears I need to add more code to insert the date into that specific cell. Can someone please help me with this? :confused:

CurrentDb.Execute "INSERT INTO WasteListT(AccumStartDate) VALUES (" & Me.AccumStartDate & ")"
 
Database tables don't have cells. They have records. The order of the records is not fixed in the table and Access will insert them wherever it feels like.

If you want to reliably show them in a particular order you must use a query.
 
Database tables don't have cells. They have records. The order of the records is not fixed in the table and Access will insert them wherever it feels like.

If you want to reliably show them in a particular order you must use a query.

Thank you! I'm new to Access and still learning.
 
Each record (row) should have a unique key (often named ID) that IDentifies the record.

INSERT is used to add new records. You use UPDATE to modify existing ones.

CurrentDb.Execute "update WasteListT set AccumStartDate =#" & format(AccumStartDate,"mm/dd/yyyy") & "# where ID=5"
 
Each record (row) should have a unique key (often named ID) that IDentifies the record.

INSERT is used to add new records. You use UPDATE to modify existing ones.

CurrentDb.Execute "update WasteListT set AccumStartDate =#" & format(AccumStartDate,"mm/dd/yyyy") & "# where ID=5"


Thank you, that worked perfect!
 

Users who are viewing this thread

Back
Top Bottom