Michael Katz
asked on
Forms with Unbound sections / fields
I have an Form Header Unbound Combo Box 'SalesComponent' with a RowSource as a sql statment..
How can i link a field that i have in the Detail section to the Unbound record in the Form Header...This record needs to change every time a new selection is made within this 'SalesComponent' Combo Box..
I am sure it is simple...but I just can get it right
How can i link a field that i have in the Detail section to the Unbound record in the Form Header...This record needs to change every time a new selection is made within this 'SalesComponent' Combo Box..
I am sure it is simple...but I just can get it right
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Check with this: table a(f1, ...).
Combo name: cmdRecord in Form header.
Combo name: cmdRecord in Form header.
Private Sub cmdRecord_AfterUpdate()
Me.RecordSource = "select * from a where f1=" & cmdRecord
End Sub
I think, some clarification is in order. My suggestion was based on understanding your question as how to make an unbound text field on the form to have the same value as selected in the combobox.
Others' suggestions show how to make the form to navigate to the record where bound textbox would have the same value as selected in the combobox.
From your initial question it's not 100% clear which one is the case.
Others' suggestions show how to make the form to navigate to the record where bound textbox would have the same value as selected in the combobox.
From your initial question it's not 100% clear which one is the case.
it's not really a link, but you can simply use
Me.Recordset.FindFirst "ID=" & Nz(Me.NameOfYourCombobox,0
ID is the name of the field in the table which should contain the primary key (usually an Autoincrement ID) which is also the first column in the unbound combobox as hidden column.
Use this line in the "AfterUpdate"-Event of the unbound combobox.
Cheers,
Christian