DTPicker and Database

Posted on 2003-02-26
Medium Priority
Last Modified: 2010-04-07

I was wondering whether you can return a date from a database table to a DTPicker. Something like this

If adoComp.Recordset.Fields(0) = st Then
        lblID = adoComp.Recordset.Fields(0)
        txtSponsor = adoComp.Recordset.Fields(2)
***     DTPicker1 = adoComp.Recordset.Fields(1)***
        cmbType1 = adoComp.Recordset.Fields(3)
        cmbType2 = adoComp.Recordset.Fields(4)
        cmbType3 = adoComp.Recordset.Fields(5)
        cmbHoles = adoComp.Recordset.Fields(6)
        cmbMarkers = adoComp.Recordset.Fields(7)
        Exit Sub
End If

Where Field(1) is of text format holding "Saturday, 23 March 2003"!
Question by:Briankerr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 43

Expert Comment

ID: 8026023
DTPicker1.Value = CDate(adoComp.Recordset.Fields(1).Value)


Author Comment

ID: 8026129
I seem to get a type mismatch when i do that!

Expert Comment

ID: 8026895
I have done a similar thing on one of my VB6 databases.  I added a text box to the form and set it's datasource / field to the date field in the database.  Then I added this code to the text box:

Private Sub txtDateFrom_Change()
If IsDate(txtDateFrom.Text) Then dtpDateFrom = txtDateFrom.Text
End Sub

You could add a text box to the form, set it's datasource to the field in the database (and set it's visible property to false if you don't want to see it).  Then adapt the above code to update the DTPicker.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 8940450
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
LVL 49

Expert Comment

ID: 8973037
Briankerr, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Save as PAQ -- No Refund.

DanRollins -- EE database cleanup volunteer

Accepted Solution

Computer101 earned 0 total points
ID: 9668042
PAQed - no points refunded (of 20)

E-E Admin

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question