Sorry, but you’ll have to post the SQL for the query before anyone can figure out why you get an error.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Parameter Query (97 VR1)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Parameter Query (97 VR1)
- This topic has 5 replies, 2 voices, and was last updated 23 years, 9 months ago.
AuthorTopicWScharlotte
AskWoody LoungerAugust 7, 2001 at 12:31 am #358825Viewing 4 reply threadsAuthorReplies-
WScharlotte
AskWoody LoungerAugust 7, 2001 at 10:27 pm #536456Try this instead. I aliased to two tables to simplify reading the code and to eliminate the need for all those brackets around the table names. Plus alias seem to make the query more efficient. The In operator is also a lot faster than the individual conditions joined by Or.
I’ve seen the “too complex” error before when you use a calculated expression in a where clause without referencing the specific table the field belongs to.
SELECT C.Status, B.[1 Cycle], B.[Batt Date], C.[Cust #], B.[Batt Prepay],
B.BattType, B.NumberofBatteries, [Batt Prepay]-[NumberofBatteries] AS Remaining,
FirstOfMonth([Batt Date],[1 Cycle]) AS BatteryDueDate
FROM [QryCustomerName&Address] AS C
INNER JOIN QryBatteryPlan1 AS P
ON C.[Cust #] = P.[Cust #]
WHERE C.Status In (“Current” , “REFERRAL”, “VET”, “Vet Staff”, “REF.”, “REF..”, “PITA”)
AND B.[Batt Prepay]-B.[NumberofBatteries]>=1
AND FirstOfMonth(B.[Batt Date],[1 Cycle])=[Enter Battery Due Date:]; -
WScharlotte
AskWoody LoungerAugust 7, 2001 at 10:56 pm #536464Aliasing of tables in SQL is just like aliasing a field or an expression. When you have “[Batt Prepay]-[NumberofBatteries] AS Remaining” in your SQL, you’re creating an alias, “Remaining” for the expression “[Batt Prepay]-[NumberofBatteries] “. You alias tables the same way. The alias gives you a handy label to use when referring to the table or expression.
You can do this easily in the query grid itself by opening the properties sheet for one of the tables and changing the alias from the actual table or query name to whatever you want to call it. I usually use 1-letter aliases to keep the SQL more readable. When you do it this way, the query engine will change the SQL to use the new alias instead of the actual table name except in the FROM clause where it *must* know the actual name of the table or query that’s being used.
Try creating a new query using the SQL I posted and see whether that will run. If it works, then just replace the old query with that one.
-
WScharlotte
AskWoody Lounger -
WScharlotte
AskWoody LoungerAugust 9, 2001 at 10:41 pm #536828I think you may be still having reference problems. You should always fully reference the fields in the Where conditions. Try this:
SELECT B.Status, A.[1 Cycle], A.[Batt Date], B.[Cust #], A.[Batt Prepay], A.BattType, A.NumberofBatteries, A.[Batt Prepay]-A.[NumberofBatteries] AS Remaining, FirstOfMonth(A.[Batt Date],[1 Cycle]) AS BatteryDueDate
FROM [QryCustomerName&Address] AS B INNER JOIN QryBatteryPlan1 AS A ON B.[Cust #] = A.[Cust #]
WHERE (((B.Status) In (“Current”,”REFERRAL”,”VET”,”Vet Staff”,”REF.”,”REF..”,”PITA”)) AND ((FirstOfMonth(A.[Batt Date],[1 Cycle]))=[Enter Battery Due Date:]) AND ((A.[Batt Prepay]-A.[NumberofBatteries])>=1)); -
WSPatricia W
AskWoody LoungerAugust 13, 2001 at 2:42 pm #537136I just recently got a variety of error messages including the “Expression is typed incorectly or is too complex ” message involving a date and a parameter (in Access 97). After tracking down a couple of KB that might possibly relate to the problem and tearing my hair out, I finally discovered the problem — BAD DATA. I had tested my query with my test data, but as soon as I imported the _real_ data, the holes in the data appeared. You might look for null data in the field that you are creating the calculated field in your query.
Pat
Viewing 4 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
InfoStealer Malware Data Breach Exposed 184 Million Logins and Passwords
by
Alex5723
7 hours, 47 minutes ago -
How well does your browser block trackers?
by
n0ads
2 hours, 36 minutes ago -
You can’t handle me
by
Susan Bradley
4 hours, 24 minutes ago -
Chrome Can Now Change Your Weak Passwords for You
by
Alex5723
3 hours, 27 minutes ago -
Microsoft: Over 394,000 Windows PCs infected by Lumma malware, affects Chrome..
by
Alex5723
19 hours, 10 minutes ago -
Signal vs Microsoft’s Recall ; By Default, Signal Doesn’t Recall
by
Alex5723
6 hours, 43 minutes ago -
Internet Archive : This is where all of The Internet is stored
by
Alex5723
19 hours, 34 minutes ago -
iPhone 7 Plus and the iPhone 8 on Vantage list
by
Alex5723
19 hours, 39 minutes ago -
Lumma malware takedown
by
EyesOnWindows
7 hours, 54 minutes ago -
“kill switches” found in Chinese made power inverters
by
Alex5723
1 day, 4 hours ago -
Windows 11 – InControl vs pausing Windows updates
by
Kathy Stevens
1 day, 4 hours ago -
Meet Gemini in Chrome
by
Alex5723
1 day, 8 hours ago -
DuckDuckGo’s Duck.ai added GPT-4o mini
by
Alex5723
1 day, 8 hours ago -
Trump signs Take It Down Act
by
Alex5723
1 day, 16 hours ago -
Do you have a maintenance window?
by
Susan Bradley
32 minutes ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
18 hours, 45 minutes ago -
Cox Communications and Charter Communications to merge
by
not so anon
1 day, 19 hours ago -
Help with WD usb driver on Windows 11
by
Tex265
4 hours, 15 minutes ago -
hibernate activation
by
e_belmont
2 days, 4 hours ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
2 days, 8 hours ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
2 days, 11 hours ago -
Windows 11 Insider Preview build 26120.4151 (24H2) released to BETA
by
joep517
2 days, 11 hours ago -
Fixing Windows 24H2 failed KB5058411 install
by
Alex5723
1 day, 7 hours ago -
Out of band for Windows 10
by
Susan Bradley
2 days, 16 hours ago -
Giving UniGetUi a test run.
by
RetiredGeek
2 days, 23 hours ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
3 days, 7 hours ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
1 day, 2 hours ago -
Auto Time Zone Adjustment
by
wadeer
3 days, 11 hours ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
3 days, 9 hours ago -
Manage your browsing experience with Edge
by
Mary Branscombe
9 hours, 3 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.