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 
OR in VBA Code
Monica Jones 
       
3 years ago
I'm new to VBA code, I've followed along with several things Richard has done but now I'm branching out on my own. I want to open a form that is filtered down to two numbers from a foreign key. I've been trying to use OR and Googling this. Access won't acknowledge the fields exist and Google doesn't know what I'm talking about. What is the VBA specific term for OR?

TIA
Monica Jones OP  @Reply  
       
3 years ago
FYI this is my code - SELECT TitleID Time TitleStatusID FROM ShowT WHERE TitleStatusID = 126 OR TitleStatusID = 142
Kevin Robertson  @Reply  
          
3 years ago
You need commas to separate the fields.

SELECT TitleID, Time, TitleStatusID FROM ShowT WHERE TitleStatusID = 126 OR TitleStatusID = 142
Gregory Clancey  @Reply  
    
3 years ago
Monica, I encounter challenges like this as well. Can you try simply creating a standard query and then examine the SQL page? This may show the syntax for directing Access. No need for this query to be integrated with your form in any way; just a standalone construct - later deleted - which reveals "how Access does it."
Monica Jones OP  @Reply  
       
3 years ago
Thank you both for your help. Kevin, the commas helped, but didn't fix my OR statement. Gregory, pulling SQL from a regular query was what fixed my OR statement here's what I ended up with, either of you know why all those parentheses are necessary?
SELECT ShowT.* FROM ShowT WHERE (((ShowT.TitleStatusID)=126)) OR (((ShowT.TitleStatusID)=142)) ORDER BY ShowT.Title;
Kevin Yip  @Reply  
     
3 years ago
Those parentheses are not needed, not in this instance anyway, and they are not the reason why your original SQL didn't work.  The reason lied somewhere else, maybe the field names: TitleID, Time, TitleStatusID.  Are those your actual, correct field names?  If your original SQL had the wrong field names, it wouldn't work, obviously.
William Dowler  @Reply  
      
3 years ago
TIME is a reserved word. You can't use it as a field name.

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: 4/30/2026 8:46:47 AM. PLT: 1s