Inputting Date automatically

G

Guest

I have a table that is updated by a combination of a delete, append and
update queries, what I would like to do is insert the date that the recoed
was last updated into a field "LastUpdated", is this possible and how would I
do it? I can insert a date/time stamp for the table but would be really
useful if I could do it for each record

MTIA
 
B

Brendan Reynolds

Setting the Default Value property of the LastUpdated field to =Now() will
take care of the appends, so you only need to deal with the updates, like so
....

UPDATE tblTarget SET tblTarget.LastUpdated = Now();
 
G

Guest

Hi,

I tried doing this and assuming I need to change tblTarget to my table I
enter the following line in my import modulke:-

UPDATE Planned Procurement SET Planned Procurement.LastUpdate = Now()

When I run it I get a expected end of statement error on procurement, if I
place quotation marks around the names I get the same error message for SET
any ideas as to why?

MTIA
 
R

Rick Brandt

souchie40 said:
Hi,

I tried doing this and assuming I need to change tblTarget to my table I
enter the following line in my import modulke:-

UPDATE Planned Procurement SET Planned Procurement.LastUpdate = Now()

When I run it I get a expected end of statement error on procurement, if I
place quotation marks around the names I get the same error message for SET
any ideas as to why?

Table names with spaces (bad idea) need to be surrounded with brackets.

UPDATE [Planned Procurement] SET [Planned Procurement]![LastUpdate] = Now()
 
G

Guest

Well I except that its bad practice but I'm stuck with it for now, however
bracketing as suggested still gives an expceted end of statement for the
expression SET

MTIA

Rick Brandt said:
souchie40 said:
Hi,

I tried doing this and assuming I need to change tblTarget to my table I
enter the following line in my import modulke:-

UPDATE Planned Procurement SET Planned Procurement.LastUpdate = Now()

When I run it I get a expected end of statement error on procurement, if I
place quotation marks around the names I get the same error message for SET
any ideas as to why?

Table names with spaces (bad idea) need to be surrounded with brackets.

UPDATE [Planned Procurement] SET [Planned Procurement]![LastUpdate] = Now()
 
R

Rick Brandt

souchie40 said:
Well I except that its bad practice but I'm stuck with it for now,
however bracketing as suggested still gives an expceted end of
statement for the expression SET

Where are you putting this? It needs to be in a query. To execute it from
code requires more that just entering the SQL directly in the code window.
 
G

Guest

oh,
I run the import of data within a module on the press of a button on the
main switchboard, that was where I was expecting to put the statement
 
G

Guest

Want back and added the relevant bits to the update query now does a proper
job

Many thanks
 
N

nilesh

hgfhgfhgfhgfhgfhgfhgfhgfhghgfh

-----Original Message-----
From: souchie40 [mailto:[email protected]]
Posted At: Wednesday, November 30, 2005 3:26 PM
Posted To: microsoft.public.access
Conversation: Inputting Date automatically
Subject: Inputting Date automatically


I have a table that is updated by a combination of a delete, append and
update queries, what I would like to do is insert the date that the recoed
was last updated into a field "LastUpdated", is this possible and how would I
do it? I can insert a date/time stamp for the table but would be really
useful if I could do it for each record

MTIA
 

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