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 
Expected End Sub
Ben Harosh 
  
5 years ago
Hi,
I came to the video:
https://www.youtube.com/watch?v=NOZ9z-9a46w
And I performed all the steps.
As soon as I click on the "Add" button I get the following error:
compile error:
Expected End sub

Attaches the code I wrote in my database:

Option Compare Database
Explicit option

Private Sub AddBth_Click ()

Private Sub Addbutom_Click ()

    If IsNull (ProductCombo) Then
        DoCmd.GoToControl "ProductCombo"
        ProductCombo.Dropdown
        Exit Sub
    End If
        
    DoCmd.GoToRecord,, acNewRec
    ProductID = ProductCombo
    Productname = ProductCombo.Column (1)
    UnitPrice = ProductCombo.Column (2)
    Notes = Nz (DLookup ("Notes", "ProductT", "ProductID =" & ProductCombo), "")
    Me.Refresh
        
End Sub
Alex Hedley  @Reply  
           
5 years ago
Private Sub AddBth_Click ()
End Sub

Private Sub Addbutom_Click ()
. . .
End Sub
Alex Hedley  @Reply  
           
5 years ago
Careful of your spelling

Did you rename the button at some point?
Ben Harosh OP  @Reply  
  
5 years ago
No, but I tried to do it a few times (I deleted and returned the button)
Alex Hedley  @Reply  
           
5 years ago
When you delete the button from the Form view you also need to clean up your VBA.
Richard Rost  @Reply  
          
5 years ago
Hi Ben. Yes, you answered your very own question when you typed it in. The compiler said "expected: End Sub." You are missing the End Sub from the first Sub you started in your code. Programming requires very specific syntax. I'd suggest watching my Intro to VBA video and perhaps at least the first couple Access Developer classes if you're serious about modifying the VBA in my templates.

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 8:58:30 AM. PLT: 0s