Re: Filtering data

From: gazelle (gazelle_at_discussions.microsoft.com)
Date: 07/27/04


Date: Tue, 27 Jul 2004 09:25:10 -0700

I have a similar problem with 2 comboboxes except that both comboboxes need to return values to be stored in a table. Any ideas about how to do that?

If I use the forgoing code it will work properly on one record but will blank out the values to the same field in all other records.

Any assistance in this regard would be greatly appreciated.

"fredg" wrote:

> On Fri, 23 Jul 2004 09:05:02 -0700, shaj wrote:
>
> > Thanks Fred for the valuable info. The code is running and the "& Me!Dept &;" is getting the right Dept_ID value but Combo2.Row Source which I have named Provider shows "" in the debug stage.
> > Provider.RowSource = "select tb_lkp_Provider.PROVIDER_NAME from tb_lkp_Provider Where tb_lkp_Provider.DIVISION_ID = " & Me.Dept & " Order by Provider_Name;"
> > What am I doing Wrong.
> > Thank you once again for your help.
> > Shaji
> > "fredg" wrote:
> >
> *** snipped ***
>
> Are you sure that there are no Null provider names. You're sorting
> Ascending so missing provider names will appear at the beginning of
> the list.
>
> If that is not the case, then ....
>
> Create a new query. Do Not add any table to the grid.
> Click on SQL View to show the SQL window.
> Paste your code directly (without the first and the last quote marks)
> into the window so it looks like this:
>
> select tb_lkp_Provider.PROVIDER_NAME from tb_lkp_Provider Where
> tb_lkp_Provider.DIVISION_ID = " & Me.Dept & " Order by Provider_Name;
>
> Then change
> " & Me.Dept & " to
> [Enter Dept]
>
> so now it looks like this:
> select tb_lkp_Provider.PROVIDER_NAME from tb_lkp_Provider Where
> tb_lkp_Provider.DIVISION_ID = [Enter Dept] Order by Provider_Name;
>
> Click on the Query Run tool button.
> You will get a prompt to enter the Dept number.
> Run it several times with different Dept number values.
> Do you get the correct providers for the number you entered?
>
> If so, the code is correct.
> If not you can play with the query in design view until you get it
> working.
> Then copy the SQL and paste it back into the
> Provider.Rowsource = "Select .. etc...." statement in the form.
> Changing
> [Enter Dept] back to
> " & Me!Dept & "
>
> Run it now.
> If you do not get the correct data, then something is wrong with the
> Me!Dept value the SQL is getting.
> Place a breakpoint on that line.
> Open the form and click on the combo1 button.
> When the code stops, hover your command button over the Me!Dept part
> of the code. The value should appear where the cursor is. Is it the
> correct number value?
>
> --
> Fred
> Please only reply to this newsgroup.
> I do not reply to personal email.
>