Briankerr
asked on
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"!
I was wondering whether you can return a date from a database table to a DTPicker. Something like this
If adoComp.Recordset.Fields(0
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"!
ASKER
I seem to get a type mismatch when i do that!
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.
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.
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?
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?
Briankerr, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:
Save as PAQ -- No Refund.
DanRollins -- EE database cleanup volunteer
Moderator, my recommended disposition is:
Save as PAQ -- No Refund.
DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Perhaps.