Query works fine as main form but doesn`t work in sub-form

  • Thread starter Thread starter debtanu
  • Start date Start date
D

debtanu

I am using a form where one selects the Main-Item-Group from ComboBox1
and automatically Items relevant to that group gets filled up ComboBox2
..

The query which makes ComboBox2 fill with records is as below :-
SELECT ItemList.ItemName FROM ItemList WHERE
ItemList.GroupName=Forms!Vendor!ComboBox1

I am refreshing ComboBox1 in the after update event with the following
code:-
Private Sub ComboBox1_AfterUpdate()
Me!Item.Requery
End Sub

Everything works fine when the form is independent. But strangely it
stops working when it is a part of a main form i.e. I make it a
sub-form.

It promts for the value "Forms!Vendor!ComboBox1"

Any clues why it happens ? Can I make any alternative reference ?
Thanks for any help extended. I am using Access 2003.

Regads,
Dev
 
You have to identify it with the main form like this --
Forms!MainForm!Vendor!ComboBox1
 
Tried your suggestion, but it doesn`t work. As per your comment does

Forms!MainForm!Vendor!ComboBox1
mean
Forms!MainForm![Name of Sub Form]!ComboBox1 ?

I have also tried
Forms![NameOfYourForm]![NameOfSubformCtl].Form![Combo1]
it aslo fails.

Regards,
Dev
 
Back
Top