Changing Datafield at RunTime
I have a connection to a MS Access database through a DataEnvironment using
MS Jet 4.0. I have a form that has patient information and a tabstrip to
select which insurance info is shown. The insurance info is just about 4
fields that are all in the same table (i.e. Ins1, Ins1WkAuth...). I have
the following code to change the Fields at runtime:
Private Sub tsIns_Click()
If tsIns.SelectedItem = "Tertiary" Then
txtMR.DataField = "MRNum3"
cmbIns.DataField = "Ins3"
txtHrsWk.DataField = "Ins3WkAuth"
txtHrsMn.DataField = "Ins3MnAuth"
ElseIf tsIns.SelectedItem = "Secondary" Then
txtMR.DataField = "MRNum2"
cmbIns.DataField = "Ins2"
txtHrsWk.DataField = "Ins2WkAuth"
txtHrsMn.DataField = "Ins2MnAuth"
ElseIf tsIns.SelectedItem = "Primary" Then
txtMR.DataField = "MRNum1"
cmbIns.DataField = "Ins1"
txtHrsWk.DataField = "Ins1WkAuth"
txtHrsMn.DataField = "Ins1MnAuth"
Only when I click the tab strip and the fields start to change it gives me
a databinding error that the new field is not updatable and then throws the
'Object required' run time error. How can I change the datafields at runtime???