A
Anand
Hello,
I am using an A2000 app. I am trying to create a table in
VB code with a date field (myDate). The default value
of myDate is set to a variable stAttDate which is a user
input. My code looks something like this:
Dim stAttDate As Date
Dim dbs As DAO.Database
Dim tbldef As TableDef
stAttDate = Me.ACalendar
Set dbs = CurrentDb
Set tbldef = dbs.CreateTableDef("tempAttendance")
With tbldef
..Fields.Append .CreateField("AttDate", dbDate)
End with
tbldef.Fields!AttDate.DefaultValue = stAttDate
The code works fine. Only the format of the date is
wrong. If the user enters 07-Sept-03 the default value
(in the myDate
field) turns into 09-July-03. I checked the code in break
mode and the date format of the stAttDate variable is
correct.
I cant seem to figure out how to get this right. Please
help.
Thanks in advance,
Anand
I am using an A2000 app. I am trying to create a table in
VB code with a date field (myDate). The default value
of myDate is set to a variable stAttDate which is a user
input. My code looks something like this:
Dim stAttDate As Date
Dim dbs As DAO.Database
Dim tbldef As TableDef
stAttDate = Me.ACalendar
Set dbs = CurrentDb
Set tbldef = dbs.CreateTableDef("tempAttendance")
With tbldef
..Fields.Append .CreateField("AttDate", dbDate)
End with
tbldef.Fields!AttDate.DefaultValue = stAttDate
The code works fine. Only the format of the date is
wrong. If the user enters 07-Sept-03 the default value
(in the myDate
field) turns into 09-July-03. I checked the code in break
mode and the date format of the stAttDate variable is
correct.
I cant seem to figure out how to get this right. Please
help.
Thanks in advance,
Anand