Skip to main content
Known Participant
June 11, 2010
Question

passing time value to Access using cfinsert/cfupdate

  • June 11, 2010
  • 1 reply
  • 1082 views

When either adding or updating records in an Access database, using cfinsert or cfupdate, time values always get set to 12:00 AM. The Access field is set to Data type:Date/Time. The value is set from the following field:

<cfinput type="text"
                        name="StartTime"
                        value="#StartTime#"
                        required="no"
                        validate="time"
                        validateat="onsubmit">

All other fields get populated correctly, including two Date fields.

I have a sinking feeling that my answer is going to be to not use cfinsert/cfupdate, but I await with bated breath.

This topic has been closed for replies.

1 reply

Inspiring
June 11, 2010

I did a quick search on msaccess datatypes and didn't notice any time fields. Are you sure it really is one, and not a datetime field formatted for time only in access?

earacheflAuthor
Known Participant
June 11, 2010

Sorry, I must not have been clear. The Access field I'm referring to is indeed a Date/Time type.

I have two fields which are intended to hold dates and two fields which are intended to hold times. In the cfform, the two Date cfinputs use USDATE validation and the two Time fields use TIME validation. When either inserting or updating a record, the dates get inserted/updated correctly in the database, but the times get set to 12:00 AM.

Inspiring
June 11, 2010

Out of curiousity, what is the date portion of the field when you insert just the time?

If you want to continue to use cfinsert/cfupdate, you can always change the form values by prepending the appropriate date string to the time value.