I have a combobox (Database), a data control (ConnectedDatabase) and a text box (ConnectedField).
I am trying to write a sub that will look up correct details from an INI file based on the contents of the combobox and using these details I want to set the DatabaseName and RecordSource properties of the data control before setting the DataField property of the text box. ie. I want to display the values of a certain field from a certain database in the text box.
So I wrote this:
Private Sub Refresh_Records()
ConnectedDatabase.DatabaseName = GetFromINI(INILoc, Database.List(Database.ListIndex), "Database"
ConnectedDatabase.RecordSource = GetFromINI(INILoc, Database.List(Database.ListIndex), "Table"
ConnectedField.DataField = GetFromINI(INILoc, Database.List(Database.ListIndex), "IndexField"
End Sub
This works fine when called upon a FormLoad event but not upon the combo box Click event. If I try running from the Click event I get the error:
"Unable to bind field: 'thefield'"
What am I doing wrong to make it work only under some events?
Thanks
I am trying to write a sub that will look up correct details from an INI file based on the contents of the combobox and using these details I want to set the DatabaseName and RecordSource properties of the data control before setting the DataField property of the text box. ie. I want to display the values of a certain field from a certain database in the text box.
So I wrote this:
Private Sub Refresh_Records()
ConnectedDatabase.DatabaseName = GetFromINI(INILoc, Database.List(Database.ListIndex), "Database"
ConnectedDatabase.RecordSource = GetFromINI(INILoc, Database.List(Database.ListIndex), "Table"
ConnectedField.DataField = GetFromINI(INILoc, Database.List(Database.ListIndex), "IndexField"
End Sub
This works fine when called upon a FormLoad event but not upon the combo box Click event. If I try running from the Click event I get the error:
"Unable to bind field: 'thefield'"
What am I doing wrong to make it work only under some events?
Thanks