By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,234 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,234 IT Pros & Developers. It's quick & easy.

Run-time Switching of Command Button Picture

NeoPa
Expert Mod 15k+
P: 31,419
What needs to be set and/or changed when switching the Picture property of a Command Button within VBA code?

The scenario is that I have a continuous form for a particular table. The controls (in total) are too wide to fit easily on the form, so I have split the form into two (logically that is). Some controls are shown in mode A and the rest are shown in mode B. The Command Button I have that switches modes works fine (hiding and showing the relevant controls) but I can't find how to swap the Command Button Picture from [RightArrow (Blue)] to [Left Arrow (Blue)] and vice versa.
Jan 11 '08 #1
Share this Question
Share on Google+
11 Replies


Rabbit
Expert Mod 10K+
P: 12,357
I tried to find the original bitmaps, alas I failed, couldn't find them in any of the logical choices.
Jan 11 '08 #2

NeoPa
Expert Mod 15k+
P: 31,419
Yeah, I did too. Thanks for looking anyway. Appreciated.
Jan 11 '08 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Yeah, I did too. Thanks for looking anyway. Appreciated.
I've had problems in the past with this as well. It seems you can't directly access the bitmaps. I replaced the Access bitmaps with my own and it works fine.
Jan 12 '08 #4

NeoPa
Expert Mod 15k+
P: 31,419
Thanks Mary :)
I'm not sure I want to go to all that trouble with this. I'm always nervous with images anyway. Not much experience there I'm afraid. I might have the two buttons and just show the one that's not in use.
Jan 12 '08 #5

ADezii
Expert 5K+
P: 8,624
Hello NeoPa, sorry I jumped in late. The original Bitmaps that you are seeking reside in a 'shared' Office Pool in a Bitmap Slab. Office XP stores this hugh collection of Bitmaps as an Office-wide resource as a single 'slab' in one of its .DLLs. Storing them this way saves on Graphics Resources and in addition, Access provides its own set of extra Button Bitmaps mostly for historical purposes. Msaccess.exe provides a Method for retrieving a single Bitmap from the slab which involves an Index into this group of Bitmaps and the subsequent filling of a Byte() Array with the requested Bitmap. I've condensed a large amount of Code and Objects to a single Form, Query, and Module. This will give you the capability to either Save a specific Bitmap from the 'slab' to disk as a *.BMP, or to assign it to the Picture Property of an Object. This functionality will give you access to the 226 Bitmaps used by Access and the 5,700 used by Office. In your case, I assume that you may want to Save them to disk, then load them into selective Controls. I answered a similar Post in November and I'll now post the Link below which contains some of the previous explanations. I am going on vacation for a couple of days starting tomorrow, but if you like, I can send you the relevant code to Extract/Save the requested Bitmaps, then utilize them in your Database.
Access Bitmaps - where are you?
Jan 13 '08 #6

NeoPa
Expert Mod 15k+
P: 31,419
I assume from the fact that you're offering a DB rather than explaining the process that it's a little bit "involved".

Please do send the DB and I'll see if I can understand and use it. Where possible, I'm looking to avoid use of external items (items stored in DLLs etc) except where automatically handled in the application (API etc). If there is a procedure provided this may be useful. I'll have to dig in and have a look-see.

Thanks anyway for your help ADezii.

PS I'm assuming you already have my em address. If not just let me know & I'll PM it be reply :)
Jan 14 '08 #7

MMcCarthy
Expert Mod 10K+
P: 14,534
The other option is to use two command buttons and toggle them visible/invisible as required.
Jan 14 '08 #8

Expert 100+
P: 446
The other option is to use two command buttons and toggle them visible/invisible as required.
I endorse Mary's solution here.

I used to 're-cycle' command buttons and detect their current state/function by their Caption. I was forced out of this when I started to write multi-lingual applications and now realise it is much 'cleaner' to always keep one function per button.

S7
Jan 16 '08 #9

ADezii
Expert 5K+
P: 8,624
I assume from the fact that you're offering a DB rather than explaining the process that it's a little bit "involved".

Please do send the DB and I'll see if I can understand and use it. Where possible, I'm looking to avoid use of external items (items stored in DLLs etc) except where automatically handled in the application (API etc). If there is a procedure provided this may be useful. I'll have to dig in and have a look-see.

Thanks anyway for your help ADezii.

PS I'm assuming you already have my em address. If not just let me know & I'll PM it be reply :)
I assume from the fact that you're offering a DB rather than explaining the process that it's a little bit "involved".
Actually, it is very straightforward and not that involved. It is simply much easier looking at the code in operation rather than posting it. I decided to Upload the DB (38K) should anyone else be interested, hope you don't mind.
Jan 17 '08 #10

NeoPa
Expert Mod 15k+
P: 31,419
The other option is to use two command buttons and toggle them visible/invisible as required.
Thanks Mary. I updated post #5 to say what I'd intended. My bad :(
Jan 17 '08 #11

NeoPa
Expert Mod 15k+
P: 31,419
Actually, it is very straightforward and not that involved. It is simply much easier looking at the code in operation rather than posting it. I decided to Upload the DB (38K) should anyone else be interested, hope you don't mind.
Of course not :)
A better idea entirely. I'll get back to you when I've had a chance to look through it properly.
Jan 17 '08 #12

Post your reply

Sign in to post your reply or Sign up for a free account.