How can I have this IIF query running?

This is my query :

strQuery = "SELECT DISTINCT ID_emp,name,adres,city, " _
                & " sports = IIF(EXISTS(SELECT ID_sport FROM tblSports WHERE 
ID_pers= tblArbCtr.persID), 1, 0)" _
                & " FROM tblArbCtr,tblEmployee WHERE Contract = 0 AND 
tblArbCtr.persID=tblEmployee.ID_emp"

I want to find out the employees who don't have a contract (contract=0) 
first, and after that I want to verify whether they have a sport with the 
derived 'sports' column. The compiler fires the following error :    '3061 : 
Too few parameters. expected 1'

Any idea how I need to change the query to have it running. I've already 
checked the table and field names, they all are correct. Maybe it's a wrong 
use of the IIF operator.

regards,
Oscar 


0
Oscar
4/9/2007 7:26:44 AM
access.queries 6343 articles. 1 followers. Follow

1 Replies
731 Views

Similar Articles

[PageSpeed] 44

I have it running now!
I needed to position the 'sports' field at the end :   .... AS sports

 strQuery = "SELECT DISTINCT ID_emp,name,adres,city, " _
                & " IIF(EXISTS(SELECT ID_sport FROM tblSports WHERE ID_pers= 
tblArbCtr.persID), 1, 0) AS sports " _
                & " FROM tblArbCtr,tblEmployee WHERE Contract = 0 AND 
tblArbCtr.persID=tblEmployee.ID_emp"



"Oscar" <oku@xs4all.nl> schreef in bericht 
news:%23h2FohneHHA.3956@TK2MSFTNGP03.phx.gbl...
> This is my query :
>
> strQuery = "SELECT DISTINCT ID_emp,name,adres,city, " _
>                & " sports = IIF(EXISTS(SELECT ID_sport FROM tblSports 
> WHERE ID_pers= tblArbCtr.persID), 1, 0)" _
>                & " FROM tblArbCtr,tblEmployee WHERE Contract = 0 AND 
> tblArbCtr.persID=tblEmployee.ID_emp"
>
> I want to find out the employees who don't have a contract (contract=0) 
> first, and after that I want to verify whether they have a sport with the 
> derived 'sports' column. The compiler fires the following error :    '3061 
> : Too few parameters. expected 1'
>
> Any idea how I need to change the query to have it running. I've already 
> checked the table and field names, they all are correct. Maybe it's a 
> wrong use of the IIF operator.
>
> regards,
> Oscar
> 


0
Oscar
4/9/2007 9:13:40 AM
Reply:

Similar Artilces:

can't send or receive emails
this just happened this week. I get this message....The connection to the server has failed. Subject 'help', Account: 'mail.comcast.net', Server: 'smtp.comcast.net', Protocol: SMTP, Port: 80, Secure(SSL): No, Socket Error: 10060, Error Number: 0x800CCC0E........your advice to to change smtp port to 25 or 587 or 80 does not work???? Port 80 is definitely wrong for that server; whose advice was that? Comcast wants you to use these email settings: http://www.comcast.com/Customers/FAQ/FaqDetails.ashx?Id=3D2288 Note that the outgoing server now requires port 5...

Access 97 can't resize database window
My database window with the listings of forms tables etc was adjusted to a smaller width, but resizing it is completely disabled and renders Access 2007 utterly useless for me. Is there anyway to 'reset' the window? ...

Can I copy radio buttons so that the second set is independent of.
I have a group of four radio buttons that all point to one cell. My goal is to create a second set that looks identical to the first but which points to a second cell. This is for a questionaire that will have many questions with the same four answer values. I want to be able to quickly create 100 button groups that will each update a separate cell for scoring of the questionaire. There are optionbuttons on the Control toolbox toolbar and there are optionbuttons on the Forms toolbar. Each has different behaviors. If I had to use lots, I'd use the Forms version. Here's a pos...

iif then in MSAccess
if someone could help me write this query I'd really appreciate it. I want it to return the lessor of the two dates: so it would be in english is account open date is less then the referral date then account open date else referral date. Sounds so easy in english now how do I get it to work in access??? Thank you! -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200705/1 iif has been depecrated you should be usnig CASE WHEN THEN look for more info in SQL Server Books online "Laura1 via AccessMonster.com" <u31091@uwe...

Running Money 2003 in Vista
Hi I run this version perfectly satisfactorily in my Vista Ultimate desktop.with my normal log on. No fiddling was required to get it to start. It worked perfectly out of the box, just as in XP Referring to emails on earlier versions in the Newsgroup, my data is in a Documents folder on the D Drive well away from Vista, though it is secured. In this machine SSL2 is not enabled I have a newish laptop running Windows Home Premium with a similar configuration for all my data on the D drive. I recently tried to open Money for the first time since installation using a copy of the Money fil...

How can I get 32-bit Integers?
I am using Access MS Office 2007 with VBA 6.5, on Win XP. My Integer type is just 16 bits, i.e. its max value is 32,767. How can I configure it so as to have 32-bit Integers, along with 64-bit Longs? "Renny Bosch" <noname@nospam.com> wrote in message news:OqqNyqmuKHA.4492@TK2MSFTNGP05.phx.gbl... > I am using Access MS Office 2007 with VBA 6.5, on Win XP. My Integer type > is just 16 bits, i.e. its max value is 32,767. How can I configure it so > as to have 32-bit Integers, along with 64-bit Longs? An Access Integer is 16 bits. A Long Integer is...

Can SUMPRODUCT be used for entire column?
This formula results in a numeric result: =SUMPRODUCT((A1:A20)*(B1:B20="b")) but this formula results in a #NUM! result: =SUMPRODUCT((A:A)*(B:B="b")) Which means I need to specify the length of the columns, which may grow over time. Any way to do this for the entire column, without having to specify the length of the column? XL07 removed the limitation on array formulas (which SUMPRODUCT is, even though it doesn't require CTRL-SHIFT-ENTER) and entire columns. For pre-XL07, one can use =SUMPRODUCT(A1:A65535, --(B1:B65536="b")) to get all but on...

OE6 can't start due to message store prob
"Outlook Express could not be started. The application was unable to open the Outlook Express message store. Your computer may be out of memory or your disk is full (0x8007000E,5)" This happens after I try to copy in backed up .dbx files. ...

Can't create Organizational Forms Library in Exchange 2003 with SP
Hello, I cannot create an Organizational Form in EFORMS REGISTRY folder (from First Administrative Group->Folders->Public Folders->EFORMS REGISTRY in ESM). When I right-click the EFORMS REGISTRY folder and select New, there is no Organization Form. Instead, I only see Public Folder in the popup menu. Do you have any idea why Organizational Form menu does not show? My Exchange Server is Exchange 2003 with SP2. The login user is Administrator. Could you please help me? Thank you very much. Yang Is that account member of "Enterprise Admins" group? Yang Zhang wrote: &...

Can you delete Business Alerts?
I cannot see any way to delete Business Alerts, can someone tell me how? I am using GP 8.0 -- Sheri Salomone THANKS! Try going to Cards --> System --> Business Alerts. -- Charles Allen, MVP "Sheri Salomone" wrote: > I cannot see any way to delete Business Alerts, can someone tell me how? > I am using GP 8.0 > -- > Sheri Salomone > THANKS! woo hoo! Thank you! -- Sheri Salomone THANKS! "Charles Allen" wrote: > Try going to Cards --> System --> Business Alerts. > -- > Charles Allen, MVP > > > > "Sheri Salo...

Office 2007 forms
I am creating a form with office 2007, will those people who do not use office 2007 be able to fill in my form? should I save it in a particular format? thanks Provided you start from the normal template, don't use fonts that were introduced with Word 2007, and save the form in Word 97-2003 document format, anyone with Word 97 or later should be able to open it. Use only the legacy form fields, to which end http://gregmaxey.mvps.org/Classic%20Form%20Controls.htm will make things easier. -- <>>< ><<> ><<> <>>< ><<...

Queries and Charts
Does anyone know why the expressions in queries work fine for reports but not charts? ...

Pass parameter from FORM to QUERY
I have an append query that I trying to call from a cmd btn...but it prompts me for the parameter(ie QuoteID)... How do I tye it into my call: Dim stQueName As String stQueName = "Quote Query" DoCmd.OpenQuery stQueName, acNormal, acEdit On Apr 13, 12:56 pm, jlt...@hotmail.com wrote: > I have an append query that I trying to call from a cmd btn...but it > prompts me for the parameter(ie QuoteID)... > How do I tye it into my call: > > Dim stQueName As String > stQueName = "Quote Query" > DoCmd.OpenQuery stQueName, acNormal, acEd...

How to make Run Integration work in GP 10
Can anyone tell me how to make the Run Integration tool work in GP 10. We just did our first client upgrade to GP 10 and the client has only 1 integration that they used to be able to run via the RUN INTEGRATION Tool. Any help would be greatly appreciated. -- Tammy Chavez I have the same probelm...did you get any answers to this? I have to go into Integration Manager to run it b/c Tools>Run Integration does nothing. I even checked the ini files to make sure the path is correct. "Tammy Chavez" wrote: > Can anyone tell me how to make the Run Integration tool work in...

Can the data in a chart table be right justified?
Ecxel 2003 and previous versions of the product center the data in the data columns. Can the data in the columns of a chart table be right justified? In article <DABF738B-6C0D-458B-B082-FA9BD8F126A7@microsoft.com>, =?Utf- 8?B?c2FtIGVhZ2xl?= <sam eagle@discussions.microsoft.com> says... > Ecxel 2003 and previous versions of the product center the data in the data > columns. Can the data in the columns of a chart table be right justified? > Have you tried to format the table? If yes, and you haven't been successful it is probably because XL allows very limited cust...

can I snap wrap points to a text box
rather than having to add individual wrap points to the edge of a frame, which is never as accurate anyway, can they be set to 'snap' to a frame (eg the ellipse) so that they are perfectly inline, (and which would of course be a lot quicker)? Edit points will not snap. There are options for edit points, select a point, right click. If you hold down control, the cursor will turn into an x, you can delete a point with a click. Truly a good draw program would be preferable. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com &q...

Changing query execution sequence
Hi all, I got a spreadsheet which would execute a bunch of queries. It's noted that the queries are executing in the sequence of when it was added to the spreadsheet. Does anyone out there know of a way to switch the order without deleting and recreating them? Thanks! Wing ...

Why ClassWiard can't see my Class?
I created a class(Class-A), derived a class(Class-B) which derived from CWnd class. When I used mouse right-click on the new-created class, it shows a popup-command-menu which missing "add virtual function" and "add windows message handler". From ClassWizard I couldn't see the new-created class either. I tried to delete myprogram.clw & re-issue ClassWizard, but it doesn't help. Anyone can help ? Thanks, Eagle "EagleChen" <xx@xx> wrote in message news:uRGde941DHA.3496@TK2MSFTNGP11.phx.gbl... > I created a class(Class-A), derived a class(C...

Publisher can not save file
I recently started having troubles with my Publisher 2003. Whenever I go to save my files now, using save as or just the save button, it gives me a dialog box that says "Can not save file." It does that twice, then it disappears. I also noticed that when it does this, it leaves the .tmp files in the directory where I tried to save. I can change the name of the files, and sometimes it will save it. Most of the time not though. I have NAV, and I noticed that it was said there was an issue with Publisher and NAV. Is this the same with the 2005 version, and is this anything anyone...

how can i edit the positioning of the balloon comment in a word fi
how can i edit the positioning of the balloon comment in a microsoft word file ? please reply on my email What you can do is adjust the space reserved for the balloons in the margin. In Word 2007, on the Review tab, click Track Changes, and then click Change Tracking Options. Change the "Preferred width" setting. -- Stefan Blom Microsoft Word MVP "melikelmalik" <melikelmalik@discussions.microsoft.com> wrote in message news:80E5F3D3-04A0-4E81-B154-FA8459B25F00@microsoft.com... > how can i edit the positioning of the balloon comment in a mi...

Report Can Grow not aligned horizontally
I have a report where I have 1 row of text, memo, number, and date fields. The memo field can contain up to 4-5 lines of wrapped text. I have set all teh rows to "can grow". However, on my report, the conditional formatting doesn't grow. For instance, the fill (which I have set to a gray color) in the memo field is about 3 lines deep when there is a lot of text in the memo field, but the text and number fields associated with that record are actually only 1 line. This essentially looks like a mess, small gray filled boxes for the text fields and a large gray ...

Money 04 runs very slow
file size is 17,480 kb, about 5 years data. Machine is a P4 2.2 GHz, 512 mb ram. Money runs very slow, processing downloaded statements, switching screens, etc. I switched from Quicken about a year ago. That didn't run nearly this slow. Any ideas? Will trimming the file size help at all or much? Thanks Ideas? See http://umpmfaq.info/faqdb.php?q=4. Trimming? Most people haven't had great luck trying this through means like File|Archive--which, by the way, I'd discourage for any number of reasons. "Tom Orlando" <anonymous@discussions.microsoft.com> wrote i...

Run time error 5 : HQClient
When I double click HQ Client I have message box "Run time error 5 : Invalid procedure call or argument" how should I do? I used RMS 2.0 -- TOY2TOY ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGr...

How can I print on 8 1/2"x17" paper?
I have cut down an 11x17 paper to 8 1/2" x 17". I cannot figure out how to change the paper size to accept and print anything bigger than 14." any suggestions would be greatly appreciated First make the size settings in the Printer Setup. You may need to use the Custom selection. -- Don Vancouver, USA "mickilena" <mickilena@discussions.microsoft.com> wrote in message news:1AD99AFE-7FE7-4A07-9D20-1B1AFF9856BD@microsoft.com... >I have cut down an 11x17 paper to 8 1/2" x 17". I cannot figure out how to > change the paper size to accept a...

how can I do a lookup into another sheet?
how can I do a lookup into another sheet? thanks ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ Try something like =VLOOKUP(123,Sheet2!A1:B10,2,FALSE) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "melawaisi" <melawaisi.ws67m@excelforum-nospam.com> wrote in message news:melawaisi.ws67m@excelforum-nospam.com... > > how can I do a lookup into another sheet? > thanks > > > ------...