The date function doesn't include the time of day. Use the Now() function and then don't worry about the format.
Duane
> To: MS_Access_Professionals@yahoogroups.com
> From: dbalorenzini@yahoo.com
> Date: Wed, 17 Jul 2013 02:08:51 +0000
> Subject: [MS_AccessPros] General date format keeps changing
>
> I have created a table that has a field called ModifiedDate defined as DateTime and format as General. However when I am trying to update it through code on a form with the following code:
>
> Private Sub Form_BeforeUpdate(Cancel As Integer)
> On Error GoTo BeforeUpdate_Err
>
> ' Set bound controls to system date and time.
> Me.ModifiedDate = Date
> 'TimeModified = Time()
>
> BeforeUpdate_End:
> Exit Sub
>
> BeforeUpdate_Err:
> MsgBox Err.Description, vbCritical & vbOKOnly, _
> "Error Number " & Err.Number & " Occurred"
> Resume BeforeUpdate_End
>
>
> End Sub
>
> But when it runs it is inserting the date as a short date on the form. I doubled checked the form field and it has a General Date format. I need to have the field display both date and time. Am I missing something?
>
> Thanks
>
> Art Lorenzini
> Sioux Falls, SD
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
[Non-text portions of this message have been removed]
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar