• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

DTPicker and Database

Hey,

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"!
0
Briankerr
Asked:
Briankerr
1 Solution
 
TimCotteeCommented:
DTPicker1.Value = CDate(adoComp.Recordset.Fields(1).Value)

Perhaps.
0
 
BriankerrAuthor Commented:
I seem to get a type mismatch when i do that!
0
 
kshoreCommented:
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
CleanupPingCommented:
Briankerr:
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?
0
 
DanRollinsCommented:
Briankerr, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Save as PAQ -- No Refund.

DanRollins -- EE database cleanup volunteer
0
 
Computer101Commented:
PAQed - no points refunded (of 20)

Computer101
E-E Admin
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now