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

continuous form buttons with different images (from table)

P: n/a
An Access 2000 question


is is possible to have (as a subform) a continous form with 0..n
buttons which have different images in each row.

(Personally I would have preferred a button array and assign images in
code, much easier with a class module - but unfortunately Access does
not support control arrays).

Here is my table that should create 4 buttons on the subform, when
filtering for process printStart.

btnId - Number - number of button on screen to iterate
btnProcess - Text(20) - Process, e.g. Print Finish, Screen, Die Cut
(some processes do not have filter buttons!)
btnImg - Text(20) - Name of Button Picture (normal status)
btnImg_Active - Text(20) - Name of Button Picture in "Selected" State
btnSound - Text(20) - reserved for future use
btnCaption - Text(50) - Caption of button (displayed in separate
label, because button will have Picture)
btnFilterMc - text(20) - For building a query filter on parent form
Selected - Yes/No - to make buttons behave like "radio buttons"

(beware line breaks)
btnId,btnProcess,btnImg,btnImg_Active,btnSound,btn Caption,btnFilterMc,isSelected
1,PrintStart,image1.bmp,image1_a.bmp,,T3000A,T3000 A,Yes
2,PrintStart,image2.bmp,image2_a.bmp,,T3000B,T3000 B,No
3,PrintStart,image3.bmp,image3_a.bmp,,T3020,T3020, No
4,PrintStart,image4.bmp,image4_a.bmp,,T4000,T4000, No

Each button triggers a query filter for displaying data in a listbox
pertaining to a certain (Print Process) Machine => btnFilterMc. Each
button should be graphic style and have its own unique image, which
should be
if Me.Selected=No _
if Me.Selected=Yes _
Is this possible?
Also a Label underneath the button should display btnCaption.

If this is possible I could create a generic form with different
(optional) filter buttons with uniqe images that would work like radio
buttons. Otherwise I would have to create 6 different forms (some of
them with some without buttons) and it would create a lot of work on
2nd and 3rd plant integation.

thanks in advance

Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies

P: n/a
I have a bunch of screen shots here of continues forms, and you can see that
a lot of them have buttons with a image:

So, I assume (if you look at the above), you want each button to have a
different image. Nope, you can't do that, as those continues forms buttons
are the SAME copy. (you might get away using a fixed form on the left side
with 15 buttons, and then match up a continuous form on the right side with
room for 15 records. You would then "change" the buttons images on the left
side in code. However, scrolling would make this VERY hard to match the
records to the images.

So, at this point, I think you need to use the listview control...or even a
contorl like tlist7

(sone screen shots here:)

and more about the contorl here:
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
Nov 13 '05 #2

P: n/a
Hi Axel

I think you CAN do this. I have written continuous subforms using a
Bound Object Frame. You create a table with an OLE Object field which
you use as the recordsource for the subform and then you bind the Bound
Object Frame to this field. You can put images into the table by
opening it in access and right-clicking the box for the field and
selecting Insert Object... I think you are limited though to using
bitmaps here.

In my app the user just clicks the Bound Object Frame which responds to
the click events like a button. However, you could put the Bound
Object Frame on top of a button object if you really wanted it to look
like an ordinary button. Or you could have 2 OLE Objects in your table
(I think this is closer to what you are after) and copy the selected
version of the bitmap into the bound-to field when the Bound Object
Frame is clicked.


Nov 13 '05 #3

P: n/a
thanks Albert for the reply.

scrolling is not a problem there will be max 6 buttons (probably only
5) on screen. The reason I wanted an array is that there are (about) 10
different screens with varying numbers of process steps (a few of these
have no filters, e.g. Ink so I need to hide all the buttons). I come
from a C++, VB background and do not like copy and paste coding, that's
why control arrays in VB were quite handy

Listview might be a solution as long as I can populate it with bitmaps
at runtime. TList is definitely overkill and the customer doesn't want
to use 3rd party controls.

I might stick with static buttons and make only used ones visible, then
use ADO to iterate my table and set

While Not rs.EOF
Select Case nLoop
case 1:
case 2:
End Select

clunky code but Access isn't C++ or VB, unfortunately. Maybe its
possible to access the control in a way like
Controls.button("cmdFilter" & nLoop) that would make it easy to code -
any idea?

Nov 13 '05 #4

P: n/a
hmm, sounds probably more complicated than it is.

I only want to store the file name of the button image as text field
and the image should be loaded at run time, is that covered by what you
describe? The button doesn't have to look like a button because I can
always stick the "button" in the image to make it look like a button -
am I making sense?


thanks for you input

PS: Given a choice I would use much less form bound coding and do as
much as possible in code, it is so much less oblique. Especially when
using yummie classes. And you can actually debug it and source control
it an all these good things; no need to poke around in overbearing
forms and torturous object properties and unreadable query windows...

Nov 13 '05 #5

P: n/a
I might stick with static buttons and make only used ones visible, then
use ADO to iterate my table and set

clunky code but Access isn't C++ or VB, unfortunately. Maybe its
possible to access the control in a way like
Controls.button("cmdFilter" & nLoop) that would make it easy to code -
any idea?

Remember, any collection in VB6, or ms-access can be ref by the keyid.
Collections are the "key" to un-locking ms-access..

if cmdFitler1 was the first contorl, then

me!cmdFilter1 =
me(0) = (controls is the default collection)
me.Contorls(0) =
me("cmdFilter1") =

Note the last one, and how string expression was used. This applies to forms
collections, reports collections, and in fact virtually any collection in
VB6 or access can be referenced by a string, or "index" value. Note that
ms-access shares the same compiler as VB6, just a different forms object
model without control arrays!).

So, if I had 10 controls on a form, (lets use a text box control), then to
fill all of them with the text "hi"

for i = 1 to 10
strC = "cmdFilter" & i
me(strC).Value = "hi"
next i

Note the use of .value (in ms-access .text property of a control has a
DIFFERENT meaning then don't get bitten on that one!!).

You can thus use a string var to reference a form, forms controls, or even
fields in a reocrdset. This concept of referencing collections is universal
to all of VB6, or VBA (they are the same in this regards). (even a ADO
reocrdset works this way with fields collecitons). So, the only tough work
ahead here is to learn the collections in ms-access objects like forms etc.
(which by the way are far more complex then vb forms).

Good luck.....
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.