473,441 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

Using a Parameter In() Statement with values from a form

Hi, I have created a query that uses a value selected from a list box in a form. The problem is that I need the query to accept multiple parameters as well as individual ones. I tried to make the default value for the list box "value1" Or "value2" Or "value3" so users could leave it blank to return all 3 but this didn't work.

I know from looking at the Microsoft support website (KB210530) that you can create two types of Parameter In() Statement that allow you to supply multiple parameters to a query but I don't know how to combine either of these with a form.

This is the SQL from the query:

SELECT tblTests.CRN, tblTests.PAT, tblTests.TESTED, tblTests.GENDER, [KR CONVERT XLOC CODES].OUT AS XLOC, tblTests.CHLM, tblTests.GONN, tblTests.CAT, tblTests.AGE, tblTreatment.TREATED, tblTreatment.NURSE, qryPostcode.Prefix, qryPostcode.Suffix

FROM (((((tblClinicDetails RIGHT JOIN (((tblTreatment RIGHT JOIN tblTests ON tblTreatment.CRN = tblTests.CRN) LEFT JOIN tblTreatmentClinic ON tblTreatment.TTMTCLIN = tblTreatmentClinic.[LOC CODE]) LEFT JOIN [KR CONVERT XLOC CODES] ON tblTests.XLOC = [KR CONVERT XLOC CODES].[IN]) ON tblClinicDetails.XLOC = [KR CONVERT XLOC CODES].OUT) LEFT JOIN qryPostcode ON tblTests.CRN = qryPostcode.CRN) LEFT JOIN tblPCT ON tblTests.PCT = tblPCT.PCTCode) LEFT JOIN [LOCAL CURRENT POSTCODES] ON (qryPostcode.Prefix = [LOCAL CURRENT POSTCODES].[POST PRE]) AND (qryPostcode.Suffix = [LOCAL CURRENT POSTCODES].[POST SUFF])) LEFT JOIN PCTS ON [LOCAL CURRENT POSTCODES].PCT = PCTS.[Organisation Code]) LEFT JOIN tblPCT AS tblPCT_1 ON tblClinicDetails.PCT = tblPCT_1.PCTCode

WHERE (((tblTests.TESTED) Between [Forms]![fDOHRpt]![DOHFrom] And [Forms]![fDOHRpt]![DOHTo]) AND ((tblTests.CHLM)="P") AND ((tblTests.CAT)="s01" Or (tblTests.CAT)="s04" Or (tblTests.CAT)="s09") AND ((IIf(IsNull([Organisation Name]),IIf(IsNull([tblPCT].[PCT]),IIf(IsNull([tblPCT_1].[PCT]),"UNKNOWN PCT",[tblPCT_1].[PCT]),[tblPCT].[PCT]),[Organisation Name]))=[Forms]![fDOHRpt]![PCTList])) OR (((tblTests.TESTED) Between [Forms]![fDOHRpt]![DOHFrom] And [Forms]![fDOHRpt]![DOHTo]) AND ((tblTests.GONN)="P") AND ((tblTests.CAT)="s01" Or (tblTests.CAT)="s04" Or (tblTests.CAT)="s09") AND ((IIf(IsNull([Organisation Name]),IIf(IsNull([tblPCT].[PCT]),IIf(IsNull([tblPCT_1].[PCT]),"UNKNOWN PCT",[tblPCT_1].[PCT]),[tblPCT].[PCT]),[Organisation Name]))=[Forms]![fDOHRpt]![PCTList]));

I'm working with Access 2003 and Windows XP Professional.

This is the first time I've posted on this forum so if I've missed out anything you need to help then please let me know.

Thanks.

Paul
Sep 5 '07 #1
2 1540
Rabbit
12,516 Expert Mod 8TB
Use Like FormControl & "*" instead.
Sep 5 '07 #2
Rabbit
12,516 Expert Mod 8TB
Resuscribing .
Sep 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
2
by: zlatko | last post by:
There is a form in an Access Project (.adp, Access front end with SQL Server) for entering data into a table for temporary storing. Then, by clicking a botton, several action stored procedures...
2
by: J Krugman | last post by:
I have a form with a couple of submit buttons, plus a "pseudolink" that is also supposed to submit the form; the submitted form data feeds to a CGI script. The two submit buttons have the name...
4
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We...
3
by: amywolfie | last post by:
Hi All: I would like to run a report based on criteria from 3 unbound combo boxes located on a parameter form (combo boxes are: cboCuisine, cboLocation, and cboRestaurant) The present code...
19
by: bdt513 | last post by:
I am trying to extract the values from a query using VBA. Specifically, I want to concatenate all the values of the "rosEmail" field from query "qselRosterEmailList" into one string (strEmails). I...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
6
by: MLH | last post by:
I have a query (SQL below) that operates on values entered by users into an unbound form to append a record to tblAdmin. I do not under- stand the basis for the error. There are some 17 or so data...
7
by: Darko | last post by:
Hello, I have this particular problem with eval() when using Microsoft Internet Explorer, when trying to define an event handler. This is the code: function BigObject() { this.items = new...
6
by: tshad | last post by:
I was looking at a page that showed how to set up a custom event and it seems to work ok. But I am not sure how I would use it. How would I subscribe to it. There is actual action (such as...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.