Computer Learning Zone CLZ Access Excel Word Windows

The nitrogen in our DNA, the calcium in our teeth, the iron in our blood, the carbon in our apple pies were made in the interiors of collapsing stars. We are made of starstuff.

-Carl Sagan
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Visitor Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Enable or disable buttons in access
Tom De Pelsmaeker 

4 years ago
I'm lost here. I've tried different ways to enable/disable 2 buttons on my form based on if a field is empty or not. I have tried it with Form_Current() and with AfterUpdate() and i keep failing. even used isnull and tried different methods, still nothing. I hope there is anyone who can help me.

the fist button needs to be enabled only when all 4 fields aren't empty

the second button needs to be enabled only when one field is empty and the other is not.

These are the diffrent codes i tried under after update or form current and failed:

----------------------------------------------------------------
Dim lot As Variant
Dim prt As Variant
Dim qty As Variant
Dim ord As Variant

lot = Me.LotNumberField.Value
prt = Me.PartNumberField.Value
ord = Me.BLOrderNumber.Value
qty = Me.PartOrderedQuantity.Value

AddNewPartOrderedButton.Enabled = Not IsEmpty(lot + prt + ord + qty)
AddNewLotButton.Enabled = Not IsEmpty(prt) And IsEmpty(lot)
----------------------------------------------------------------

Dim lot As Variant
Dim prt As Variant
Dim ord As Variant
Dim qty As Variant

lot = Me.LotNumberField
prt = Me.PartNumberField
ord = Me.BLOrderNumber
qty = Me.PartOrderedQuantity

If Not IsEmpty(lot) And Not IsEmpty(prt) And Not IsEmpty(ord) And Not IsEmpty(qty) Then
    Me.AddNewPartOrderedButton.Enabled = True

Else
    Me.AddNewPartOrderedButton.Enabled = False

End If

If Not IsEmpty(prt) And IsEmpty(lot) Then
    Me.AddNewLotButton.Enabled = True

Else
    Me.AddNewLotButton.Enabled = False

End If
----------------------------------------------------------------
Kevin Robertson  @Reply  
          
4 years ago
Does this work for you?

If IsNull(LotNumberField) And IsNull(PartNumberField) And _
         IsNull(BLOrderNumber) And IsNull(PartOrderedQuantity) Then
    AddNewPartOrderedButton.Enabled = False
Else
    AddNewPartOrderedButton.Enabled = True
End If

If Not IsNull(PartNumberField) And IsNull(LotNumberField) Then
    AddNewLotButton.Enabled = True
Else
    AddNewLotButton.Enabled = False
End If

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Visitor 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: 5/6/2026 7:43:29 AM. PLT: 0s