Update Time Field (1 Viewer)

Geoff Codd

Registered User.
Local time
Today, 04:47
Joined
Mar 6, 2002
Messages
190
Hi there,

I have a table of data which contains a time field which I need to update, I have created a select query to find the records that need updating

SELECT Format([Time],'nn') AS [Minute]
FROM tblFlexima_Profile_Data
WHERE (((Format([Time],'nn')) Between '16' And '45' And Not (Format([Time],'nn'))='30'));

The problem I am having is that when I change it to an update query and tell it to update the selection to 30 it doesn't work.

Any ideas appreciated, thanks in advance

Geoff
 

Brianwarnock

Retired
Local time
Today, 04:47
Joined
Jun 2, 2003
Messages
12,701
Hi

I don't know what your update code was, did you use TimeSerial?

Brian
 

Geoff Codd

Registered User.
Local time
Today, 04:47
Joined
Mar 6, 2002
Messages
190
When I change it to an update query and try and run I get the error

'Format([Time],'nn')' is not a valid name, make sure it does not include invalid characters or punctuation and that it is not too long.

Any ideas

Thanks
Geoff
 

Brianwarnock

Retired
Local time
Today, 04:47
Joined
Jun 2, 2003
Messages
12,701
Geoff Codd said:
When I change it to an update query and try and run I get the error

'Format([Time],'nn')' is not a valid name, make sure it does not include invalid characters or punctuation and that it is not too long.

Any ideas

Thanks
Geoff
The code in your update to should be TimeSerial(Hour([Time]),30,0) it will not accept nor does it need the Format function.

Brian
 

Brianwarnock

Retired
Local time
Today, 04:47
Joined
Jun 2, 2003
Messages
12,701
Geoff Codd said:
Hi there,

I have a table of data which contains a time field which I need to update, I have created a select query to find the records that need updating

SELECT Format([Time],'nn') AS [Minute]
FROM tblFlexima_Profile_Data
WHERE (((Format([Time],'nn')) Between '16' And '45' And Not (Format([Time],'nn'))='30'));

The problem I am having is that when I change it to an update query and tell it to update the selection to 30 it doesn't work.

Any ideas appreciated, thanks in advance

Geoff


If you prefer to see the SQL it should be

UPDATE tblFlexima_Profile_Data SET tblFlexima_Profile_Data.Time = TimeSerial(Hour([Time]),30,0)
WHERE (((Format([Time],"nn")) Between 20 And 45 And (Format([Time],"nn"))<>30));

Brian
 

Users who are viewing this thread

Top Bottom