Display records added since last time opened

M

Melinda Chase

Hello,
I have a form that I'd like to filter to show the records that were added
since the last time I opened the database. So far, I've added a table to my
personal front end to store the date I last opened the database
(tblDateLogged). I've set up a form filter (which works when I type in a
date). I've tried adding code to the form to log the date when I close the
form. That's the part that isn't working. I tried the On Close event, but
it said it couldn't find my table. I'm really not sure how to proceed. I
want the date to get overwritten each time.
Any ideas?
Thanks,
Melinda
 
M

Marshall Barton

Melinda said:
I have a form that I'd like to filter to show the records that were added
since the last time I opened the database. So far, I've added a table to my
personal front end to store the date I last opened the database
(tblDateLogged). I've set up a form filter (which works when I type in a
date). I've tried adding code to the form to log the date when I close the
form. That's the part that isn't working. I tried the On Close event, but
it said it couldn't find my table. I'm really not sure how to proceed. I
want the date to get overwritten each time.


The code in the Close event could be like:

CurrentDb.Execute "UPDATE tblDateLogged " _
& "SET datefield = Date()"
 
M

Melinda Chase

Marshall Barton said:
The code in the Close event could be like:

CurrentDb.Execute "UPDATE tblDateLogged " _
& "SET datefield = Date()"

I'm missing something here.
Here's what I put in:

CurrentDb.Execute "UPDATE tblDateLogged" & "SET DateLogged=Date()",
dbFailOnError

When I close the form, I get a 3144 error. What did I do wrong?
Thanks,
Melinda
 
M

Marshall Barton

Melinda said:
I'm missing something here.
Here's what I put in:

CurrentDb.Execute "UPDATE tblDateLogged" & "SET DateLogged=Date()",
dbFailOnError


You left out a critical space:

CurrentDb.Execute "UPDATE tblDateLogged SET
DateLogged=Date()", dbFailOnError
 
M

Melinda Chase

Marshall Barton said:
You left out a critical space:

CurrentDb.Execute "UPDATE tblDateLogged SET
DateLogged=Date()", dbFailOnError

Thanks Marsh,
That did it!
Melinda
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top