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
-
MS Passkey
by
pmruzicka
4 hours, 38 minutes ago -
Can’t make Opera my default browser
by
bmeacham
6 hours, 32 minutes ago -
*Some settings are managed by your organization
by
rlowe44
4 hours, 25 minutes ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
5 hours, 27 minutes ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
1 day, 1 hour ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
1 day, 10 hours ago -
AI slop
by
Susan Bradley
14 minutes ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
1 day, 11 hours ago -
Two blank icons
by
CR2
14 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
1 day, 20 hours ago -
End of 10
by
Alex5723
1 day, 23 hours ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
20 hours, 54 minutes ago -
test post
by
gtd12345
2 days, 5 hours ago -
Privacy and the Real ID
by
Susan Bradley
1 day, 19 hours ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
1 day, 11 hours ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
2 days, 9 hours ago -
Upgrading from Win 10
by
WSjcgc50
21 hours, 4 minutes ago -
USB webcam / microphone missing after KB5050009 update
by
WSlloydkuhnle
1 day ago -
TeleMessage, a modified Signal clone used by US government has been hacked
by
Alex5723
3 days, 1 hour ago -
The story of Windows Longhorn
by
Cybertooth
2 days, 12 hours ago -
Red x next to folder on OneDrive iPadOS
by
dmt_3904
3 days, 3 hours ago -
Are manuals extinct?
by
Susan Bradley
3 hours, 21 minutes ago -
Canonical ditching Sudo for Rust Sudo -rs starting with Ubuntu
by
Alex5723
3 days, 12 hours ago -
Network Issue
by
Casey H
2 days, 23 hours ago -
Fedora Linux is now an official WSL distro
by
Alex5723
4 days ago -
May 2025 Office non-Security updates
by
PKCano
4 days ago -
Windows 10 filehistory including onedrive folder
by
Steve Bondy
4 days, 2 hours ago -
pages print on restart (Win 11 23H2)
by
cyraxote
3 days, 3 hours ago -
Windows 11 Insider Preview build 26200.5581 released to DEV
by
joep517
4 days, 4 hours ago -
Windows 11 Insider Preview build 26120.3950 (24H2) released to BETA
by
joep517
4 days, 4 hours 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.