Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Home > Forums > Access Forum > VBA Code for Form Field by William Kennedy
Back to Access Forum    Comments List
Upload Images | @Reply | Bookmark | Link | Email | Next Unseen |
VBA Code for Form Field
William Kennedy 
    
4 years ago
I am developing a Form that enters some Data and brings data into it from other queries.
VBA Code is attached to the form field [ChkBalField]
Private Sub ChkBalField_Click()
     select Balance
    from 3qry_ChkAll
    where ChkDate = (Select Max(ChkDate) From [3qry_ChkAll])
End Sub

I would like to use this for other queries and fields into the form.  Is their a way to make it usable in other form fields by passing parameters into it.
William Kennedy OP  @Reply  
    
4 years ago

William Kennedy OP  @Reply  
    
4 years ago

William Kennedy OP  @Reply  
    
4 years ago

Kevin Robertson  @Reply  
          
4 years ago
Create a Public Sub Routine in a Global Module.
William Kennedy OP  @Reply  
    
4 years ago
Thanks Kevin, I'm just starting with VBA.  Do not know how to do that.
William Kennedy OP  @Reply  
    
4 years ago
I fixed the previous issue but now.  I use four DLookup calculations within a query.
example:
ChkBal: Format(DLookUp("[Balance]","3qry_ChkBalance"),"Currency")
They all work well.
But when I try to add the values together to get a total.  The calculated value is a a number because I can The field becomes a String value instead of a currency.  What did I do wrong?  I've tried both these ways.

Total: [ChkBal]+[SavBal]+[LTDBal]+[CharBal]

Total: (Format(DLookUp("[Balance]","3qry_ChkBalance"),"Currency"))+( Format(DLookUp("[Balance]","3qry_SavingBalance"),"Currency"))+( Format(DLookUp("[Balance]","3qry_LTDBalance"),"Currency"))+( Format(DLookUp("[Balance]","3qry_CharityBalance"),"Currency"))
Adam Schwanz  @Reply  
           
4 years ago
Have you tried CCur? CCur changes the data type, Format changes the appearance.

CCur(DLookUp("[Balance]","3qry_ChkBalance"))+...
William Kennedy OP  @Reply  
    
4 years ago
Thanks.  I will try that.

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

Next Unseen

 
 
What's This?

 

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: 11/15/2026 3:25:26 AM. PLT: 0s