Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 2447 - Invalid use of dot, ! operator, or invalid parens

Status
Not open for further replies.

mdweezer

Technical User
Jun 15, 2004
56
US
I have a form with a bunch of fields, you can select various drop downs and such and hit submit and it'll print a form using what you selected as the criteria. Well there is one field that keeps "exploding" and it gives the error described in the topic. It's a drop down using the following for its row source
Code:
SELECT TBL_Org.OrgNumber, TBL_Org.OrgName
FROM TBL_Org;
UNION select 0, "All Orgs"
from TBL_Org
ORDER BY 2;

I didn't write the code and i'm not familiar with Union queries, all I know that it selects all options from that drop down or something, but is there incorrect syntax or something? Thanks!!!!
 
Also, when I copy the value from that field i'm using:
Code:
OrgValue = Nz(cboOrg.Value)
and the error occurs on the right side of that line of code.

I have about 3 other drop downs doing the same exact thing and they work fine, all except for this one. However if I select a value from the dropdown it works fine and I don't get any errors.
 
Get rid of the ; at the end of the first FROM clause:
SELECT TBL_Org.OrgNumber, TBL_Org.OrgName
FROM TBL_Org[highlight] [/highlight]
UNION select 0, "All Orgs"
from TBL_Org
ORDER BY 2;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Ok, now i'm using
Code:
SELECT TBL_Org.OrgNumber, TBL_Org.OrgName
FROM TBL_Org
UNION select 0, "All Orgs"
from TBL_Org
ORDER BY 2;

However it still blows up on me.... Although it does populate the drop-down with the correct values that I need. Just when I leave it blank, it gives the error, but like I said, there are 3 other fields doing some the same union query so this just isn't making sense. I must be missing something somewhere
 
What is "0" in select 0, "All Orgs" ??

Are you using numbers as field names???
 
Hi

Try

SELECT TBL_Org.OrgNumber, TBL_Org.OrgName
FROM TBL_Org
UNION select 0 As OrgNumber, "All Orgs" As OrgName
from TBL_Org
ORDER BY 2;

or even

SELECT TBL_Org.OrgNumber, TBL_Org.OrgName
FROM TBL_Org
UNION select 0 As OrgNumber, "All Orgs" As OrgName
from TBL_Org
ORDER BY OrgName;

And

OrgValue = Nz(cboOrg.Value,0)

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top