Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Enable and Disable Images
Nathan Maturine 
   
4 years ago
I'm not sure if this is possible, but here goes...I would like to use a few small .png images as menu icons on a form.I was using buttons which i disabled and enabled based user permissions or customer status. I have given the icons the same name as the buttons.
Now I get "Method or data member not found".
Here is the code...

If numDays > 60 And myPolicyStatus = "Lapse" Then
    MsgBox "This Policy has lapsed for over 60 Days. Please contact your supervisor"
    Me.Command49.Enabled = False
    Me.btnMgrOverride.Visible = True
    Exit Sub
End If

Richard Rost  @Reply  
          
4 years ago
1. You don't need "Me." unless you're referring to properties, not objects.
2. Don't name your buttons CommandXX
3. You can't make a property that has the focus invisible (move the focus first)
4. WHICH line specifically is throwing the error?
Richard Rost  @Reply  
          
4 years ago
Nathan Maturine OP  @Reply  
   
4 years ago
This is the line that it doesn't like
Me.Command49.Enabled = False
Richard Rost  @Reply  
          
4 years ago
Is that the button that you're clicking on (that has the focus?) If so, you can't make it not enabled or not visible while it has the focus.
Richard Rost  @Reply  
          
4 years ago
Or you spelled it wrong. Make sure its name is "Command49" and then RENAME it to something meaningful.
Nathan Maturine OP  @Reply  
   
4 years ago
No, when the form loads. it does the checks
Nathan Maturine OP  @Reply  
   
4 years ago
I'll rename it...But if the image is not on Focus, the code should work (minus the Me)?
Kevin Robertson  @Reply  
          
4 years ago
I assume you are displaying the PNG images in an image control which does not have an Enabled property. That is why you are getting the error "Method or data member not found".
Richard Rost  @Reply  
          
4 years ago
Yeah, as long as it's spelled right, and it doesn't have the focus. The Me isn't necessary, but it won't stop your code from working (it's superfluous).
Richard Rost  @Reply  
          
4 years ago
Oh wait a minute... I missed that the first time I read your post. "I have given the icons the same name as the buttons." That's because images don't have an Enabled property.
Nathan Maturine OP  @Reply  
   
4 years ago
Is there a way to make the image unavailable in certain conditions? For example in the code i posted where the customer policy has lapsed, I do not want the user to be able to take a payment (The Command49 button opens the payment form), i need them to get a Manager Override
Richard Rost  @Reply  
          
4 years ago
I would just swap the buttons out.

If WHATEVER Then
   Image1.visible = true
   Image2.visible = false
Else
   Image1.visible = false
   Image2.visible = true
End if

Nathan Maturine OP  @Reply  
   
4 years ago
Thank you very much!!!
Nathan Maturine OP  @Reply  
   
4 years ago
Works beautifully!!! Thank you again
Richard Rost  @Reply  
          
4 years ago
You're welcome. This is the kind of stuff I cover in my Developer lessons.

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: 5/6/2026 7:28:58 AM. PLT: 1s