Oke Guys,
I need some help with VB6.0 and MSACCESS
I've a table in a mdb file with
TABLE: STRUCTURE
Formname|ObjectName|TableName|FieldName
FrmAdres|TxtCompany|Clients|Company
And
TABLE: Clients
Company|Street|ZIP etc
Then I have a Form named FrmAdres with lots of controls.
What do i want.
On Form_Load loop all the controls (textbox, combobox) search in the table
Structure and look for the source. Then goes to the correct table and field
and fill the control with that information.
This must be a public function...I only need the part to 'link' the
information...Loop the controls, get objectnames, match them in Table
structure is not the problem...only the last part.
----------------------------------------------
Public Function VulForm(FrmName as Form)
With rstClients
Do while not .eof
If !CLIENTID = SearchClient then
exit do
endif
.movenext
loop
.movefirst
end with
End With
With rstStructure
.Open "Select * from STRUCTURE", Tn, adOpenStatic, adLockOptimistic
End With
Dim ctlname As String
Dim frm As Form
Dim ctl As Control
Set frm = FrmName
For Each ctl In frm.Controls
With rstStructure
.MoveFirst
Do While Not .EOF
If !Formname = frm.Name Then
If !Objectname = ctl.Name Then
--> THIS PART
Ctl.Text = ??????????????????????
End If
End If
.MoveNext
Loop
End With
Next
End Function |