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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting different database tables to textboxes, checkboxes and dbc

Status
Not open for further replies.

gulky2002

IS-IT--Management
Nov 21, 2002
13
AT
I like to connect some tables stored in an MS Access database to textboxes, checkboxes and comboboxes. Connecting the main information (first table) in the database, which is related to entries in a combobox (second table) works well, but how can I bind a third table to a textbox, updating with the others when clicking the next or previous button? When using the next or previous button the dataset should change in all textboxes. How is the code to realize this? The same problem I have with checkboxes. How is the code binding yes/no data from a fourth table to checkboxes in the GUI?

MANY, MANY THANKS FOR YOUR HELP !!!
with regards
Hermann

Private Sub Form_Load()

Set eventhandler = New dBEvent 'eventhandler is a class module
Set bindCol = New BindingCollection

'Binding the main recordset to a textbox
With bindCol
Set .DataSource = eventhandler.rstStructuralIndicator
.Add txtStrucShortName(0), "Text", "struc_short_name"
.Add txtStrucFullName(0), "Text", "struc_full_name"

End With

'Binding a DataCombo to the main recordset

With dbcCategory
Set .DataSource = eventhandler
.DataMember = "STRUCTURAL_INDICATOR"
.DataField = "struc_indicator_id" 'Der Bezug zum Primärschlüssel
.RowMember = "INDICATOR_CATEGORY"
Set .RowSource = eventhandler 'this is a class module
.BoundColumn = "struc_category_id"
.ListField = "category"
End With

a) HOW TO REALISE TO CONNECT A THIRD TABELE IN THE DATABASE TO A CHECKBOX? IS THE CODE FOR OPTIONBUTTONS THE SAME?

b) HOW TO REALISE TO CONNECT ANOTHER SECOND TEXTBOX WITH DATA FROM A FOURTH TABLE IN THE DATABASE?


End Sub
 
I would have a separate ADODC control for each table and set their recordset filters to the DataComboBox.boundtext
You can even have a separate ADODC for the datacombo box list with it's recordsource an SQL with fields joined like ([Firstname] & " " & [Lastname] AS Fullname) Set the boundtext to the common ID Field.
ORDER by Lastname gives a good alphabetical index for the drop down list
To make each ADODC move so they are all locked on the same customer use the Sub Movecomplete for each ADODC to reset the filter of the others

Sub FirstADODC_MoveComplete ( etc)
SecondADODC.Recordset.filter=Combocontrol.boundtext
End Sub

Sub SecondADODC_MoveComplete ( etc)
ThirdADODC.Recordset.filter=Combocontrol.boundtext
End Sub
and so on
 
Thanks tedsmith,
currently I am working with an ado-control. I haev programmed the buttons previous, next, first ,last by myself. Can ypou give me a solution, how to solve my probling from this point of view?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top