subform open to cbo value

N

NetworkTrade

have inherited an unbound Form on which one control is a combobox of
Customer ID ....

would like to add subform so that when a CustomerID is selected a subform is
made visible showing that Customer's address details. subform can be bound
to Customer table or a query...

have the CustSubForm.visible=true in the AfterUpdate of the control box

not sure the way to have this subform to be showing the correct record (i.e.
value in the combobox)....and it would need to change if they select the
wrong ID and re-select another...

welcome advice...thanx
 
K

kingston via AccessMonster.com

Create a query for the customer information where the criteria for CustomerID
is [Forms]![MainForm]![ComboCustomerID]. Then use the query to create the
subform. In the AfterUpdate event, add Me.SubForm.Requery
 
D

Damon Heron

Private Sub Combo0_AfterUpdate()
Dim strsql As String

strsql = "SELECT tblCustomer.* FROM tblCustomer where CustomerID= " &
[Combo0] & ""
Me!subform1.Form.RecordSource = strsql

End Sub

HTH
Damon
 
N

NetworkTrade

gracias both.....

--
NTC


Damon Heron said:
Private Sub Combo0_AfterUpdate()
Dim strsql As String

strsql = "SELECT tblCustomer.* FROM tblCustomer where CustomerID= " &
[Combo0] & ""
Me!subform1.Form.RecordSource = strsql

End Sub

HTH
Damon


NetworkTrade said:
have inherited an unbound Form on which one control is a combobox of
Customer ID ....

would like to add subform so that when a CustomerID is selected a subform
is
made visible showing that Customer's address details. subform can be
bound
to Customer table or a query...

have the CustSubForm.visible=true in the AfterUpdate of the control box

not sure the way to have this subform to be showing the correct record
(i.e.
value in the combobox)....and it would need to change if they select the
wrong ID and re-select another...

welcome advice...thanx
 
Top