PDA

View Full Version : PLS HELP! This subform is driving me mental



tpalmer00
12-16-2007, 08:42 AM
Hi,

Sorry to be a drama queen but this is really starting to do my head in lol

I've created a form which works fine on it's own. When I move it to the main form and embed it as a subform the filtered combo boxes don't work. I've tried all sorts of code to get the filters working again but to no avail.

All i want to do is use my Training Profile form to be able to select the employee and then use the first cbo box to select a Course Category. The second cbo box then filters according to the Course Category chosen and displays a list of course names relevent to the specified category chosen.

When i embed as a subform is gives me this error: Forms!KBTPContentForm.cboCategory

Rowsource for Category cbo box:

SELECT CourseCategories.CategoryID, CourseCategories.CategoryName FROM CourseCategories ORDER BY CourseCategories.CategoryName;

Rowsource for Course cbo box:

SELECT Courses.CourseID, Courses.CourseName, Courses.CategoryID FROM Courses WHERE (((Courses.CategoryID)=Forms!KBTPContentForm.cboCategory)) ORDER BY Courses.CourseName;

Code for form:
Private Sub Category_AfterUpdate()

Me.cboProduct.RecordSource = "SELECT * from Products WHERE Category = '" & Me.cboCategory & "'"

Me.cboProduct.RecordSource.Requery


End Sub

Any advice appreciated,
Thanks Trish

XLGibbs
12-16-2007, 04:41 PM
I am not entirely certain, but the subform itself may need a primary data source.