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!

DTPicker binding to recordset???

Status
Not open for further replies.

scasystems

Programmer
Jan 15, 2003
44
0
0
GB
I am binding textboxes to a recordset and everyting is ok using this method Except when it comes to the DTPicker which doesn't bind it gives

Run-time error 545 "Unable to bind to Field or Datamember 'Expiry_Date'

I use the Tag field to set the Field_Name of the control to bind i.e.

For Each ctrl In Me.Controls
Select Case TypeName(ctrl)
Case "TextBox"
Set txtBox(ctrl.Index).DataSource = mRecordSet
txtBox(ctrl.Index).DataField = txtBox(ctrl.Index).Tag
Case "DTPicker"
'only one so dont have array of dtpickers
'cannot seem to bind to expiry_date so use hidden textbox
'Set DTPicker.DataSource = mRecordSet
'DTPicker.DataField = DTPicker.Tag '*** raises above error
End Select
Next

The field name and the ctrl.tag are the same!!!!!!!!!
The Expiry_Date field is date/time type

I have got round this by using a hidden textbox to store the date and
bind this to the recordset which works ok but not elegant solution.

Private Sub DTPicker_Change()
txtBox(2) = DTPicker.Value
End Sub

I have tried changing dataformats/ matching dataformats between field/dtpicker all to no avail. :(

Any suggestions welcome. Run out of ideas

 
If my memory serves me correctly,Microsoft says it has a bug.
I use Monthview Control in Microsoft CommonControls 2(6)
instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top