Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Invoicing    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Syntax Error
Asteropi Papadopoulou 
   
2 years ago
Can someone find the mistake in this line?
It's for an Invoice button but it keeps giving me an error

IIF("Paid"=False,docmd.OpenReport(QuotationR),IIF("Paid"=True & "AND CustomerType=" & "Χονδρικής", docmd.OpenReport(OrderInvoiceR),docmd.OpenReport(ReceiptR)))
Asteropi Papadopoulou OP  @Reply  
   
2 years ago
That customer type gibbersh is a greek word that basically means "Wholesale"
Adam Schwanz  @Reply  
           
2 years ago
("Paid"=
You need [Paid] to refer to the field, it's thinking it's a string right now, also what is the use of this? Is this vba? If/Then would make it simpler, in my opinion.
Adam Schwanz  @Reply  
           
2 years ago
You also need double double quotes presumably for the customertype if that is a string.
Adam Schwanz  @Reply  
           
2 years ago
I would write it like this, easier to follow.

If Paid=False Then
'Open Report
ElseIf Paid=True and CustomerType="Wholesale" Then
'Open Report
Else
'Open Report
End If
Asteropi Papadopoulou OP  @Reply  
   
2 years ago
I tried both ways, it's still giving me errors for both ways
Asteropi Papadopoulou OP  @Reply  
   
2 years ago
my way I still get syntax error (not the = now, just syntax error)
your way I get error 2162
Kevin Robertson  @Reply  
          
2 years ago
Your Report name should not be in parentheses and you need to tell Access how the Report should be opened, for example acViewPreview.
Asteropi Papadopoulou OP  @Reply  
   
2 years ago
I added the preview before you told me, ust forgot to write it there.
Deleted the parenthesis and still getting the same syntax error

IIF([Paid]=False,docmd.OpenReport QuotationR,acViewPreview, IIF([Paid]=True & "AND CustomerType=" & "Χονδρικής", docmd.OpenReport OrderInvoiceR,acViewPreview, docmd.OpenReport ReceiptR,acViewPreview))
Asteropi Papadopoulou OP  @Reply  
   
2 years ago
IIF([Paid]=False,docmd.OpenReport QuotationR,acViewPreview, IIF([Paid]=True & "AND CustomerType=" & "Wholesale", docmd.OpenReport OrderInvoiceR,acViewPreview, docmd.OpenReport ReceiptR,acViewPreview))
Richard Rost  @Reply  
          
2 years ago
You can't put commands inside an IIF statement like that.
Asteropi Papadopoulou OP  @Reply  
   
2 years ago
fixed it thanks
Asteropi Papadopoulou OP  @Reply  
   
2 years ago
yeah I used the If-Else If command

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

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/2/2026 12:58:39 AM. PLT: 0s