0

I am trying to filter a list of production numbers based on the staff member who made them. I am using the StaffID in column 0 of a combobox to do this.

When I try to run the code, I get a compile error. Method or data member not found.

I am new at this and am pretty sure I am doing something stupid but I can not figure out what.

This is the code:

intStaffID = Me.cmbboxStaffName.Column(0)
        
Me.subfrmProductionRecord.Form.RecordSource = "SELECT * FROM tblProductionRecord WHERE StaffID = " & intStaffID

1 Answer 1

0

You can do this with zero code if you use MasterLinkFields and ChildLinkFields properties of the subform control.

As masterfield use the Id from the combobox.

As childfield use the StaffID of subform control's recordsource.

Also, make sure the combobox is unbound.

Sign up to request clarification or add additional context in comments.

5 Comments

I need to do it this way because I will need to use multiple comboboxs to apply all the filters I may need. I dont think I can do that with master and chilf fields
OK. Your error just tells, that a field or control is missing or misspelled.
checked that. I copy pasted the names to be sure the spelling was correct
Then something else is going on.
I figured it out. I changed the name of the subform in the navigation pane but not in the properties. Thanks for the help Gustav

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.