Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / May 2005

Tip: Looking for answers? Try searching our database.

Pulling a parameter from a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jokeascool - 18 May 2005 14:01 GMT
Hello All,

I have query that pulls a parameter from a list box on a form.  The
query refrences the list box like such:

Where (Take_Offs_tbl.House_Code)=[forms]![frmschedulea]![listbox8]

My question is this.

I have a for next loop that concatenates the parameter.  What is the
proper syntax that the parameter should look like after the loop is
done.

Should it simply look like this:

"vb1"or"vb2"or"vb3"

Or should it look differntly.  Right now the query is not working
correctly and it has something to do with this parameter.

Any help would be appreciated!

Thanks

Joe
Ofer - 18 May 2005 20:40 GMT
it should look like that

in ("vb1","vb2","vb3")

Where (Take_Offs_tbl.House_Code) in ("vb1","vb2","vb3")

> Hello All,
>
[quoted text clipped - 21 lines]
>
> Joe
Marshall Barton - 18 May 2005 21:32 GMT
>I have query that pulls a parameter from a list box on a form.  The
>query refrences the list box like such:
[quoted text clipped - 13 lines]
>Or should it look differntly.  Right now the query is not working
>correctly and it has something to do with this parameter.

You can not use a parameter that contains SQL syntax.  A
parameter must represent a single value.

Here's one way to deal with this kind of situation.
Construct your list to look like ,"vb1,vb2,vb3," and place
it in a hidden text box named txtMyList on the form.  Then
use the following in the criteria row of any field in the
query so the query's WHERE ends up looking like this:

WHERE InStr(Forms!frmschedulea!txtMyList, "," &
Take_Offs_tbl.House_Code & ",") > 0

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.