combo box linked subform values

  • Thread starter Mitchell_Collen via AccessMonster.com
  • Start date
M

Mitchell_Collen via AccessMonster.com

I have created a subform and a combo box. When the user selects a value in
the combo box such as unit4, they should be able to see only unit4 details in
the subform. This is my trouble. Does anybody know how to get a combo value
to determine the subform data? I have created numerous queries and functions
but can't get this to work. Please help.

Thanks, Mitchell
 
D

Damon Heron

Without knowing all your specifics, the general solution is similar to the
following:
(the subform has a sql string to load records)

Private Sub cboUnits_AfterUpdate()
Dim strsql As String
strsql = "SELECT tblUnits.UnitID, tblUnits.Available, tblUnits.Applied,
tblUnits.Description " & _
"FROM tblUnits WHERE ((tblUnits.UnitID) = " & cboUnits.Value & ")"

Me![tblUnits subform].Form.RecordSource = strsql
Me![tblUnits subform].Form.Requery
End Sub


HTH
Damon
 
M

Mitchell_Collen via AccessMonster.com

Thanks Damon.

-Mitchell

Damon said:
Without knowing all your specifics, the general solution is similar to the
following:
(the subform has a sql string to load records)

Private Sub cboUnits_AfterUpdate()
Dim strsql As String
strsql = "SELECT tblUnits.UnitID, tblUnits.Available, tblUnits.Applied,
tblUnits.Description " & _
"FROM tblUnits WHERE ((tblUnits.UnitID) = " & cboUnits.Value & ")"

Me![tblUnits subform].Form.RecordSource = strsql
Me![tblUnits subform].Form.Requery
End Sub

HTH
Damon
I have created a subform and a combo box. When the user selects a value in
the combo box such as unit4, they should be able to see only unit4 details
[quoted text clipped - 6 lines]
Thanks, Mitchell
 

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

Top