Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MonthView / DT Picker - Neither will work

Status
Not open for further replies.

SepMan76

Technical User
Apr 5, 2001
45
0
0
US
I have a form that is bound to a table with two fields: StartTime and EndTime. I need the user to select the Date and Time for each. Rather than having a textbox for the user to have to type the date and time in (that is asking for problems), I thought to create a nice little interface.

First, I tried to have four controls on the form, all of them DT Picker. two bound to StartTime, two bound to EndTime. One of the two displayed the date mm/dd/yyyy and the other displayed the time h:mm AMPM. It works great for adding values, but when the form is opened to view or edit the values... the date that I created the controls is displayed instead of the real data (even though the control source is set to startdate/enddate). Now if the user doesn't use any of the controls, the values in the database are unchanged, but if they change one (the date for example) the changed date along with the time I created the control is saved (vs. the time that was saved in the database).

In the form_load event I tried to set the DTPicker values via DLOOKUP function. The code is executed, but an error occurs stating that the propery is a read only property.

Because the DT Picker leave a lot to be desired, I attempted to use a textbox and monthview control for the date and a listbox with times in 15min intervals for the time. with the lost_focus event, I formatted the values from the textbox and listbox to create the desired value and set it to a separate hidden text box bound to the database field. Great, right? Well, I am stuck on one thing, when a user clicks on a command button, I show the MOnthview control. It always says today. I want to set it to the date value of the textbox... it is usually a few months ahead of today. Here is the code.

Code:
Private Sub cmdStartDate_Click()
    MonthView1 = CDate(txtStartDate)
    MonthView1.Visible = True
End Sub


When the command button is clicked, I get a runtime error:
"Run-time error '-2147352567 (80020009)': MonthView returned the error: An error occured in a call to the Windows MonthView control."

Thanks! That is a helpful error code isn't it?

The error is in the line
Code:
MonthView1 = CDate
(txtStartDate)

Any suggestions would be appreciated. Thanks


Chris (sepman76)

"If I could teach any child one thing in life, it would be to value the act
of learning"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top