Hecate Posted July 18, 2011 Posted July 18, 2011 I'm running a system where I want users to enter various information including a date into a form and have the table updated with this information I've got most of it working beautifully but I've hit a snag with the date formatting This works DoCmd.RunSQL "UPDATE tbldevice SET tbldevice.DisposedDate = [forms]![frmdispdetail]![DisposedDate], .... I wanted to make the code neater and reusable so I tried Dim DispDate as date DispDate = [forms]![frmdispdetail]![DisposedDate] DoCmd.RunSQL "UPDATE tbldevice SET tbldevice.DisposedDate = '# " & Format(DispDate, "mm/dd/yyyy") & " #' ........ This gives me a 'type conversion' error. I have tried with and without US formatting, various combinations of #, double, single quotes and parenthesis but I can't get it to recognise DispDate as a date - any suggestions? I can work round it so it isn't a major issue but I really would like to know where I am going wrong
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now