Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Courses > Access > Developer > D25 > D25 Lessons < D24 Lessons | D26 Lessons >
Back to Access Developer 25 Lessons    Comments List
Product Groups 2 Upload Images   Link   Email  
Lesli Cochran     
17 months ago
My solution for computing the correct tax rate per product works but now Im faced with customers who are not taxable and/or not charged service charge/service charge tax.

This is accomplished with VBA code which provides Dlookuo values with IF THEN statement. The code in on the OrderF (main form) as an AfterUpdate event procedure. This works perfectly when adding a new proposal and entering items into the Order DetailF (sub form).

The problem lies when editing the sub form, OrderDetailF. I must click on the main form OrderF first in order for the Dlookup VBA code to populate the values.

How can write code to fix this?
Lesli Cochran     
17 months ago
Also, the code is based on the customer I'd already being loaded onto the OrderF so Onload and OnActive ever procedures resulted in errors because the code could t reference the CustomerID as it wasn't loaded into the form yet.
Lesli Cochran     
17 months ago
Code on OrderF as AfterUpdate Event

Dim TX As String, CF As String, SCTX As String, SC As String, SCR As String
    
    
    TX = DLookup("SalesTaxRate", "DefaultT")
    SCTX = DLookup("ServiceChargeTaxRate", "DefaultT")
    CF = DLookup("Istaxable", "CustomerT", "CustomerId=" & CustomerID)
    SC = DLookup("IsServiceCharge", "CustomerT", "CustomerId=" & CustomerID)
    SCR = DLookup("ServiceChargeRate", "DefaultT")
    
    If CF = True Then
        SalesTaxRate = TX
    Else
        SalesTaxRate = 0
    End If
    
    If CF = True Then
        ServiceChargeTaxRate = SCTX
    Else
        ServiceChargeTaxRate = 0
    End If
    
    If SC = True Then
        ServiceChargeRate = SCR
    Else
        ServiceChargeRate = 0
    End If
Lesli Cochran     
17 months ago
I added code to the CustomerF AddOrder button which DIM the controls on the OrderF and executed the code from the button. Then I added this code to OnCurrent OrderF with the On Error Resume Next to handle when the form is loaded from CustomerF.
Richard Rost             
16 months ago
Thanks for sharing

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

 
 
 

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 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/15/2024 7:19:56 PM. PLT: 1s