Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
My code is not working
Masih Ostad Novin 
    
3 years ago
Hi.
I have a subform in my inventary database. I want when the qty is 0 and Total qty (footer) is >= 1 then ordered be true. This is my code on current event:

If QtyOnHandCombo = 0 And QtySum >= 1 Then
        Ordered = True
    Else
        Ordered = False
    End If

But nothing happens.
Any idea??? I submit pic down below.
Thanks
Masih
Masih Ostad Novin OP  @Reply  
    
3 years ago

Scott Axton  @Reply  
      
3 years ago
Double check the name of your field.  The Qty appears to be just a regular text box.

Can you show us your form in design mode as well as the record source of the subform?
Kevin Robertson  @Reply  
          
3 years ago
Is QtyOnHandCombo referring to a Combo Box? There is no Combo Box on the Form.
Other than that I see no reason why the code shouldn't be working.

Do you have Option Explicit turned on (at the top of the Form Module)?
Masih Ostad Novin OP  @Reply  
    
3 years ago
Yes, the names are OK.
Masih Ostad Novin OP  @Reply  
    
3 years ago

Kevin Yip  @Reply  
     
3 years ago
The Current event only runs when you enter a record.  After you enter the record, if you make a change to the quantity field, the Current event doesn't run again, because that is not the event that occurs.  An AfterUpdate event of the changed field is what occurs, so maybe that's what you need.
Masih Ostad Novin OP  @Reply  
    
3 years ago
I see that the code is working on current event but then I have to move from record to record as Kevin says. I want to automate this. Unfortunately this subform is not for editing or updating otherwise it would be easier. So I put the code on the On load event of the subform but doesn't work either. Somehow I have to do this when I open the subform that the ordered checkbox meet the criteria and get the positve value.
Kevin Yip  @Reply  
     
3 years ago
The only ways to make it update all the time is (a) make Ordered a calculated field, or (b) use a query for your subform that calculates the value of Ordered.

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: 8/1/2026 4:51:22 AM. PLT: 0s