Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy a Date from a form to a Table

Status
Not open for further replies.

Maturi

IS-IT--Management
Oct 9, 2003
81
GB
Hi,

I've got a table with field called 'CheckpointDate' .
I have a form with a text entry box called 'CheckDate'. Both are formtted as medium date.

The user enters a CheckDate and clicks a button which will update the field in the table (amongst other things)

The code is:

SQLString = "UPDATE tbl_Docs SET tbl_Docs.CheckpointDate = " & Me!CheckDate & " WHERE (tbl_Docs.ReAssignFlag =Yes)"
DoCmd.RunSQL SQLString

The problem is that the actul final value in the table is sort of a time format (eg 01:01:28). Why does the date format (and value) not get carried over from the date entry to the table.

Thanks
 
When using an Access database, you should surround your date with the pound # sign.

Code:
SQLString = "UPDATE tbl_Docs SET tbl_Docs.CheckpointDate = [!]#[/!]" & Me!CheckDate & "[!]#[/!] WHERE (tbl_Docs.ReAssignFlag =Yes)"



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
George

Thanks - so obvious when you know how.

I have a related problem - prehaps you can help

I want to do a check that me!Checkdate is in the future and I am using :

If Me!CheckDate < Date() Then .. etc.

But the If statement does not seem to work. I bet I need to use # somewhere but can't get it right

Thanks
 
If you want CheckDate to be future dates, then you should use greater than, not less than.


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top