subform open to cbo value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top