Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box sync. not working!!

Status
Not open for further replies.

nerdgnome

Programmer
Aug 14, 2004
12
AU
I have tryed to set up a pair of syncronised comboboxes ("type" changing the options available in "size") on a form SFrml_Nonconformance.

They worked when the sub form was opened on it's own but not inside the main form (FRM_INPUT).

I think it's to do with the references so:

I changed the query to from!FRM_INPUT!SFrml_Nonconformance!Type

Private Sub Form_Current()
Me!SFrml_Nonconformance.Form!Size.Requery
End Sub


Private Sub Type_AfterUpdate()
Me!SFrml_Nonconformance.Form!Size = Null
Me!SFrml_Nonconformance.Form!Size.Requery
Me!SFrml_Nonconformance.Form!Size = Me!SFrml_Nonconformance.Form!Size.ItemData(0)
End Sub


Bee
temp, thrown in at the deep-end....again!
 
Yes i had a look at the site before, but couldn't work out which one to use.


Form = FRM_INPUT
SubForm = Sfrm_Nonconformances

Combo 1 = Type
Combo 2 = Size

I want to use combo 1 as the parameter for the query to populate combo 2.

Query = from!FRM_INPUT!SFrml_Nonconformance!Type

Private Sub Form_Current()
Me!SFrml_Nonconformance.Form!Size.Requery
End Sub


Private Sub Type_AfterUpdate()
Me.Size = Null
Me.Size.Requery
Me.Size = Me.Size.ItemData(0)
End Sub

Bee
temp, thrown in at the deep-end....again!
 
oops! More of a typo in the post, sorry!

Bee
temp, thrown in at the deep-end....again!
 
How about changing the combo rowsource in VBA?
Code:
Private Sub Type_AfterUpdate()
Dim strSQL As String
strSQL = "Select * from TABLE where SizeField=" _ 
& "'" & Forms!frmMaster.frmSub.Form.Type & "'"
Forms!frmMaster.frmSub.Form.Size.RowSource = strSQL
End Sub

Change the field / combo Names as required

Zameer Abdulla
Visit Me (New Look & style)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top