J
Jeremy
I use the date time picker alot in my forms. In my current database I use
the following code to set the default date of the dt picker control on my
form under the onload event:
Private Sub Form_Load()
Dim m As Integer
Dim d1 As Integer
Dim d2 As Integer
Dim y As Integer
m = Format((DateAdd("d", (2 - (Weekday(Date))), Date)), "m")
d1 = Format((DateAdd("d", (2 - (Weekday(Date))), Date)), "d")
d2 = Format((DateAdd("d", (2 + (Weekday(Date))), Date)), "d")
y = Format((DateAdd("d", (2 - (Weekday(Date))), Date)), "yyyy")
Me.DT_Start_Date.Month = m
Me.DT_Start_Date.Day = d1
Me.DT_Start_Date.Year = y
Me.DT_End_Date.Month = m
Me.DT_End_Date.Day = d2
Me.DT_End_Date.Year = y
End Sub
Keep in mind that I use this code with similar named controls on another
form within the same database with no problems, BUT, on another form I get
Run-time error '438'. What's even more odd is the fact that the form works
on my PC, but not on two other PC's. I've checked my libraries and I made
sure to register the active x control on all machines. What gives?
the following code to set the default date of the dt picker control on my
form under the onload event:
Private Sub Form_Load()
Dim m As Integer
Dim d1 As Integer
Dim d2 As Integer
Dim y As Integer
m = Format((DateAdd("d", (2 - (Weekday(Date))), Date)), "m")
d1 = Format((DateAdd("d", (2 - (Weekday(Date))), Date)), "d")
d2 = Format((DateAdd("d", (2 + (Weekday(Date))), Date)), "d")
y = Format((DateAdd("d", (2 - (Weekday(Date))), Date)), "yyyy")
Me.DT_Start_Date.Month = m
Me.DT_Start_Date.Day = d1
Me.DT_Start_Date.Year = y
Me.DT_End_Date.Month = m
Me.DT_End_Date.Day = d2
Me.DT_End_Date.Year = y
End Sub
Keep in mind that I use this code with similar named controls on another
form within the same database with no problems, BUT, on another form I get
Run-time error '438'. What's even more odd is the fact that the form works
on my PC, but not on two other PC's. I've checked my libraries and I made
sure to register the active x control on all machines. What gives?