HELP PLEASE! - Multiple Different Queries as Recordsource for one form

htmlasp

Registered User.
Local time
Today, 00:34
Joined
Oct 9, 2013
Messages
10
Hi everyone. Thanks in advance for help.

I have a query that I am using as recordsource for a form. I also have a list box that I am using to change records on the form.

My issue is I need to use the same form for similar queries. For example, I want to open the form with only "Manager1" records displayed. So I need to do a different query. I don't want to use parameters or have employees type the manager in. It needs to be just a button they click.

So my two options are - make 10 copies of the form each with their own new query recordsource for each manager, or use one form and dynamically input the recordsource before the form opens..

I want to do that -- but when I try the list box gets all screwed up. Because the list box is relying on another SELECT query to populate. I have 10 buttons each with a different recordsource query feeding into the form when I click but I get so many errors in the fields when the form opens.

I am at a loss for what to do. HELP?
 
How about a preliminary form with a combo box containing the ManagerNames and Ids. Id is hidden. The user selects the Manager from the combo.
You have a button on the Form. When that button is clicked
You open the Form you want and adjust the recordsource of the Form based on the selection from the combo.
 
How about a preliminary form with a combo box containing the ManagerNames and Ids. Id is hidden. The user selects the Manager from the combo.
You have a button on the Form. When that button is clicked
You open the Form you want and adjust the recordsource of the Form based on the selection from the combo.

Thanks for the suggestion, and I did try that as well already. The issue is that the list box SELECT query doesn't change. So I feed in the recordsource I need, but the listbox I am using to let them select records has the SELECT query that never changes, so it is screwing things up. Is there a way to feed in a specific query for the list box too? The same way I would with the recordsource for the form?
 
No. Not query. Use the list or combo to select the proper Manager, then adjust the Record source, or set a filter.

Along these lines...
If you are running a form and you want it to only have records for Manager1, then you select Manager1 from the combo (or list), and on the afterUpdate event, you modify the record source.

me.Recordsource = "Select * from MyTable where ManagerId = " & Me!listbox
me.requery
 

Users who are viewing this thread

Back
Top Bottom