Requery subform Field based on different Field's value


Joined
Jan 10, 2009
Messages
1
Reaction score
0
I need some help trying to figure out something in Access 2003. I have a main form 'A' with a subform 'B' linked using the EmployeeID=Employee_ID fields of A and B respectively. The subform loads the filtered data based on the employeeID in the subform just fine but what I'm trying to do is add a record to the subform for the employee regarding a course request.

In the subform (form B) I have a combobox whose RecordSource is the VendorName from the Vendor table and the ControlSource is a field in another table called tblCrseReq. Upon selecting the vendor, the VendorName for "CoyName" field on the subform is used to filter the available courses from that vendor in the "Course_ID" field of that same form.

This works fine using the subform's code (below) when I run the form outside of the main form however, it doesn't work within the main form as a subform. It prompts me for the value of the CoyName field.
--------------------------------------
Private Sub CoyName_AfterUpdate()
Me.Course_ID = Null
Me.Course_ID.Requery
Me.Course_ID = Me.Course_ID.ItemData(0)
End Sub
---------------------------------------
What am I missing or doing wrong?Thanks for any help.
 
Ad

Advertisements


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