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 
vba expression
Normand Caron 
      
3 years ago
When i enter the following expression.

Private Sub QcBtn2_Click()
    DoCmd.OpenForm "FamilyListF", , , "ProvinceState=""Qc"""


I get the following error.
> The expression on clisk you entered as the event property setting produced the following error: Expected: Text or Binary.
Kevin Robertson  @Reply  
          
3 years ago
You missed some quotes.

DoCmd.OpenForm "FamilyListF", , , "ProvinceState="""Qc""""
Normand Caron OP  @Reply  
      
3 years ago
I tried your quote settings and i save it but i get the same error. THANKS ANYWAY.
Alex Hedley  @Reply  
           
3 years ago
DoCmd.OpenForm "FamilyListF", , , "ProvinceState='Qc'"
Normand Caron OP  @Reply  
      
3 years ago
I get the same error with this simple expression:
DoCmd.OpenForm "FamilyListF"
Normand Caron OP  @Reply  
      
3 years ago
Same error. thanks
Kevin Robertson  @Reply  
          
3 years ago
If you create a new button and add the code to that button's Click event, does that work?
Normand Caron OP  @Reply  
      
3 years ago
Same error.
Normand Caron OP  @Reply  
      
3 years ago
the following simple expression get the same error:
Private Sub Command17_Click()
  DoCmd.OpenForm "FamilyListF"
End Sub
Alex Hedley  @Reply  
           
3 years ago
If you open the Form from the Navigation Menu what happens?
Kevin Yip  @Reply  
     
3 years ago
If even DoCmd.OpenForm "FamilyListF" causes that error, then the problem is likely in the form itself.  The statement DoCmd.OpenForm "FamilyListF" has no problem in itself in terms of VBA syntax.  I suggest opening the form manually from the navigation pane and see what happens.
Scott Axton  @Reply  
        
3 years ago
if it opens ok from the navigation pane, double check the spelling on your field.
     ProvinceState=
Normand Caron OP  @Reply  
      
3 years ago
Same error when i open the form from navigation pane. Thanks to KEVIN, ALEX, K. YIP, SCOTT
The spelling is right.
Kevin Robertson  @Reply  
          
3 years ago
Is there any code in the OnCurrent, OnOpen or OnLoad events of the form you are trying to open that may be causing a problem?

Have you tried to Compile your database? Any error?
Normand Caron OP  @Reply  
      
3 years ago
The error S/r:
I get the following error.
> The expression on click you entered as the event property setting produced the following error: Expected: Text or Binary.
Normand Caron OP  @Reply  
      
3 years ago
WHERE ARE THESE COMMANDS?
OnCurrtent, OnOpen or OnLoad
Scott Axton  @Reply  
        
3 years ago
How are you specifying the province?  Is it a field on a form, combo box, hard coded into the open button, etc. ?

I feel like you are only providing us part of the picture here and everyone at this time is kind of shooting in the dark.
You are probably going to need to provide us some screen shots of forms and / or tables in design mode, so we can see where things are going wrong.
Kevin Robertson  @Reply  
          
3 years ago
These are events that run when the form is opened.

Open the form in Design View and go to the Form Properties. Click on the Events tab. You will see the events listed.
If it says [Event Procedure] next to the event there is code in that event. Click on the builder button [...] to view the code.

If there is no code, or the code is not the problem, I would suggest rebuilding the form. You can copy any objects on the old form and paste them to the new one. Not sure if making a copy of the form would work or not as you may also be copying the problem to the new form.

If none of this works I would suggest working through the Troubleshooter.
Normand Caron OP  @Reply  
      
3 years ago
I Solved my Problem by clearing my VBA Builder and re-entering my Expression.
I guest my button was referring to the wrong expression.

Thank you all for your effort.

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 12:56:14 PM. PLT: 1s