Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Query Criteria
Arthur Reynolds 

6 years ago
Hello, Am trying to do a query criteria on a lookup field, and the system keeps showing an error message, Data type mismatch in criteria expression. I have checked the spelling. The only reason I come up with is because the field is a lookup. Is there away around this?
Thank you
Alex Hedley  @Reply  
           
6 years ago
Can you share the SQL that the query produces?
I dont tend to use LOOKUPS, there might be a issue of instead of it being a number its a string so youd need to wrap the value in single quotes.
Richard Rost  @Reply  
          
6 years ago
Arthur emailed me his SQL. It looks like this:

SELECT Customer_tbl.BusinessName, Enquiry_tbl.Site, Enquiry_tbl.EnquiryDate, Enquiry_tbl.EnquiryNumber, Quote_tbl.QuoteNumber, Quote_tbl.QuoteDate, Quote_tbl.QuoteConclusion, [Quotedate] 30 AS QuoteExpiryDate, Date()-[QuoteDate] AS DaysFromQuote
FROM ((Enquiry_tbl INNER JOIN Quote_tbl ON Enquiry_tbl.EnqID = Quote_tbl.EnquiryNumber) INNER JOIN Customer_tbl ON Enquiry_tbl.CustID = Customer_tbl.CustID) INNER JOIN CompanySiteName_tbl ON Enquiry_tbl.Site = CompanySiteName_tbl.SiteID
WHERE (((Quote_tbl.QuoteConclusion)="Pending"))
ORDER BY Customer_tbl.BusinessName, Date()-[QuoteDate] DESC;

I wouldn't put any kind of calculations in your ORDER BY, like Date()-QuoteDate. Try getting rid of that. I'd start there.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 10:54:59 AM. PLT: 1s