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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with On Current Combo requery in Subform

Status
Not open for further replies.

Hulm1

Technical User
Mar 11, 2008
100
0
0
GB
I have a form "Estimate_Item". On it, I have three cascading combo boxes. I have text boxes on top of them so that I can make the whole thing work on a continuous form. It is code I found and works brilliantly. I choose a Fitting Category, which prefills the next combo box with relevant Sub Categories. Selecting one of those prefills the next combo box with the relevant fittings.
Ace!

HOWEVER! When I place this form as a subform into my form "Estimate" I get the following

Enter Parameter Value
Forms!Estimate_Item!cboFittingCategoryID

When I clear that I get

Enter Parameter Value
Forms!Estimate_Item!cboFittingCategorySubID

I am using the following On Current event in the subform (which works fine when not a subform)

Me.cboFittingCategoryID.Requery
Me.CboFittingCategorySubID.Requery
Me.cboFittingID.Requery

For reference, the After Update events on the Combo boxes don't work either when in a SubForm. An example is below

Private Sub cboFittingCategoryID_AfterUpdate()
Me.FittingCategorySubID = 0
Me.CboFittingCategorySubID.Requery
End Sub

All help appreciated
 
How are ya Hulm1 . . .

You've simply changed [blue]form referencing[/blue] as far as the 3 comboboxes are concerned! Where you once had:
Code:
[blue]Me!TextboxName = Me!ComboboxName[/blue]
You now need:
Code:
[blue][[purple][b]subFormName[/b][/purple]].Form!TextboxName = subFormName.Form!ComboboxName[/blue]
I hope you can see this ...

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Should that be in the On Current and After Update events of the Subform? Currently the code is in the subform.

I guess it must be because I will be operating in the subform when I use a combo box. It's seriously late now and I'm getting red eyed! Going to bed. Please do reply and I will take a look in the morning.
Thanks
 
I tried a few variations of your suggestion and I am not progressing successfully. Should I be modifying the On current code of the Subform or Adding it to the Main Form? Or should I be modifying the After Update of the Combo boxes?

 
Thanks, I've bookmarked that for further reading tomorrow
Cheers
 
OK Jedraw, I have looked at that and it is a good article. I must be dumb though because I still have a problem. Would it be possible to upload my tables and forms for you to look at?
 
This is now what I am doing
On Current Event(Main Form)
Forms![Estimate]![Estimate_Fitting_Item].Form![cboFittingCategoryID] = Requery

Forms![Estimate]![Estimate_Fitting_Item].Form![CboFittingCategorySubID] = Requery

Forms![Estimate]![Estimate_Fitting_Item].Form![cboFittingID] = Requery


Subform combo box afterupdate event

This one:
[Estimate_Fitting_Item].Form![FittingCategorySubID] = 0
[Estimate_Fitting_Item].Form![CboFittingCategorySubID] = Requery

And This one:
[Estimate_Fitting_Item].Form![FittingID] = 0
[Estimate_Fitting_Item].Form![cboFittingID] = Requery

Clearly I have it all wrong though
 
[Forms]![Estimate]![Estimate_Fitting_Item].[Form]![cboFittingCategoryID]

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
Thanks very much. My problem was on the row source of the combo box. Nor referring to the Main form.

Sorted now. Thanks everyone
 
Just got back to the forum, glad you got it working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top