Combo Box Filtering between Forms

andrew_ww

New member
Local time
Yesterday, 18:38
Joined
Dec 30, 2009
Messages
3
Hello,

I have a combo box (populated via query). I want to be able to make a choice in this then click a button. This would have the action of opening another form which has been filtered to show only records associated with this record.


I've tried the way I think but I keep getting requests for 'parameters'

Here is what I currently have:


On frmMain I have a combo box which is populated with contents of query:

SELECT [qryUnloggedRFW].[doc_number] FROM qryUnloggedRFW ORDER BY [doc_number];

I then have this piece of VBA code:

Private Sub Combo151_AfterUpdate()
DoCmd.OpenForm "frmRFWNewForm", , , "[doc_number] = " & Me.Combo151
End Sub

Then on the second from I have the Record Source set as:

SELECT *
FROM tbl_management
WHERE ((([tbl_management].[doc_number])=[forms]![frmMain]![Combo151]));


Neither method works. I click the combo box it just keeps asking for several parameters (strangely its asking the contents on the combo box). I click the button to open the new form it still asks for one parameters

Any help much appreciated.

Thanks.
 
Hi,

The open form already has the where statement to filter.

Remove the WHERE clause from the SELECT statement.
 
Try to base your form on a query and then in the criteria row (in your query) for the doc_number field put [forms]![frmMain]![Combo151]
 
I removed the where clause so its just:

SELECT *
FROM tbl_management;

However the request for various parameters remain.
It still asks for 'doc number' but now its also asking for the actual contents of the como box selection.

For example if the box displays AA-BB-DD-009 it will ask for 4 times for parameters

1. Doc_Number
2. AA
3. BB
4. DD
 

Users who are viewing this thread

Back
Top Bottom