scasystems
Programmer
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
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