Re: Filtering data

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: shaj (shaj_at_discussions.microsoft.com)
Date: 07/27/04


Date: Tue, 27 Jul 2004 09:34:37 -0700

Fred,
I copied this query in SQL view and ran it and it works.
I did put a break point on this line and hovered over the Me!Dept part
of the code and it picks up the right value I selected under Dept. When I hover over the Provider.Rowsource it shows "" . This is where my problem. What would you advise me to do.
Thanks

"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.
>


Quantcast