473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Multi-select images for report - create array?

tuxalot
200 100+
I have 10 unbound image controls on a form and below each I have a bound radio button. On my report, I have 5 unbound image controls. The user selects multiple images on the form with a maximum of 5 selections. Let's assume the radio buttons representing the image controls on the form are named 1-10. Let's also assume the image controls on the report are named A, B, C, D, E. In all cases, image control A on the report will contain image 1 and image control B will contain image 2. For C, D and E they would display the remaining selected images from the form. How these images are ordered is not important. How can I dynamically assign the remaining selected images to image controls C, D and E on the report?
Nov 19 '11 #1
16 4161
NeoPa
32,556 Expert Mod 16PB
Your radio buttons are bound it seems, but you don't tell us what they're bound to. It seems a fair assumption that this must be irrelevant. None of the image controls is bound. This may be Access, but you've clearly decided not to use anything to do with a database in this question. That leaves you with standard program logic.

Process through the form to determine which images are required and set those, with your code, into the available image controls on the report. It's very non-standard, but it matches the question in that respect.
Nov 19 '11 #2
tuxalot
200 100+
The radio buttons are bound to 10 fields in a table with paths to external images (the image above the radio button in each case). The images are simply on the form to give the user a reference to what they are selecting. I do not understand how I can make image control "C" on my report show, at times, image 3 and other times show image 6.
Nov 19 '11 #3
NeoPa
32,556 Expert Mod 16PB
Tuxalot:
The radio buttons are bound to 10 fields in a table with paths to external images (the image above the radio button in each case).
This doesn't make sense, and it really needs to. What type of text field can be bound to a RadioButton control?

The rest of it I got, but without knowing your actual position better I cannot advise correctly.

If we're dealing with records in a table then the approach is totally different from what you described initially (assuming your design even supports it at all).
Nov 19 '11 #4
tuxalot
200 100+
Let me step out and get above the situation and perhaps I can do a better job at describing my needs.

In simplified terms, I have 10 images on a form of which only five can be selected. I want to present the five selected items from these ten on a report.
Nov 19 '11 #5
NeoPa
32,556 Expert Mod 16PB
Tuxalot:
Let me step out and get above the situation and perhaps I can do a better job at describing my needs.
Sounds like a good idea. Let me know when you've done so.

I hope your second sentence wasn't supposed to be it as that was less helpful even than your first attempt (and completely ignores what I've said so far). I'm sure it wasn't and I can wait for you to be ready.
Nov 19 '11 #6
tuxalot
200 100+
Honestly NeoPa I thought the second sentence would help you understand. I am not looking for code as much as direction on what options are possible. I suppose where I am getting hung up is how to allow an image control in a report to derive it's data from more than one source (ex. imgC in the report might show data from selections 3-10 in the form).

Perhaps I put 10 image controls on the report to match the 10 on the form, and collapse them if they do not have data so I can present the 5 remaining in a row. Would this be a good approach?
Nov 19 '11 #7
NeoPa
32,556 Expert Mod 16PB
No Tux. It doesn't make sense. I suspect this is because your understanding of what is stored where is somewhat lacking (I'm guessing here but it sounds that way to me). You need to understand that the report cannot access the data on the form directly, as the data is not stored on the form, but in a table that the form is bound to. That means that you need to specify some logic that enables you to see the same data on your report. This normally works by specifying a filter. So far though, you have provided no relevant information that anyone else could use to determine how to prepare any such filter. And that only describes one way that we may need to approach it. We don't even know enough from you to determine if this makes sense or if an entirely different approach is required.
Nov 19 '11 #8
ADezii
8,834 Expert 8TB
I do know what you are trying to accomplish, but I agree with NeoPa in that your methodology is not sound. The concept, as I see it, is roughly this:
  1. Loop through all the Controls on you Form.
  2. If the Control is a Radio Button, increment a Counter.
  3. If the Control is a Radio Button and is selected, increment a second, selected Counter.
  4. Make some kind of provision if the number of Selected Radio Buttons is > 5.
  5. Create a Public Array with the Absolute PATHs to the Selected Images (you indicate some kind of Pointer to this).
  6. Populate the Array.
  7. In the Open() Event of your Report, set the Picture Property of the 5 Image Controls (Image1...Image5) to the Values (PATHs) stored in the Array.
  8. This has all been tested, and works quite well.
    Expand|Select|Wrap|Line Numbers
    1. Dim ctl As Control
    2. Dim bytNumSelected As Byte
    3. Dim bytOptButton As Byte
    4.  
    5.  
    6. For Each ctl In Me.Controls
    7.   With ctl
    8.     If .ControlType = acOptionButton Then
    9.        bytOptButton = bytOptButton + 1
    10.          If .Value Then
    11.            bytNumSelected = bytNumSelected + 1
    12.              If bytNumSelected > 5 Then
    13.                MsgBox "You can only select a MAXIMUM of 5 Images"
    14.                'RESET The Radios Buttons, Clear the Array
    15.                  Exit Sub
    16.              Else
    17.                'Populate with PATHs for Test Purposes
    18.                astrImages(bytNumSelected) = "C:\Stuff\EMPID" & _
    19.                                             CStr(bytOptButton) & ".bmp"
    20.              End If
    21.       End If
    22.     End If
    23.   End With
    24. Next 
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Report_Open(Cancel As Integer)
    2. Dim bytCtr As Byte
    3.  
    4. For bytCtr = 1 To 5
    5.   Me.Controls("Image" & CStr(bytCtr)).Picture = astrImages(bytCtr)
    6. Next
    7. End Sub
P.S. Make some provisions for Erasing the Array at certain points in the Code.
Nov 19 '11 #9
tuxalot
200 100+
the report cannot access the data on the form directly
Understood.

Taking another tact.

Let's assume I have 10 columns named i1 - i10. The URL to an external image is shown in row 1 in the example below. Like this:

i1 i2 i3 i4 i5 i6 i7 i8 i9 i10
url1 url2 url3 url10

I want the data in columns i1-i10 where the URL is not null to show up as images on my report in a linear fashion (i.e. this example would be one row of 4 images, equally spaced, etc.)
Nov 19 '11 #10
tuxalot
200 100+
Thanks for the reply ADezii. I can tell that one should only post on this board if they have well thought out ideas, and possibly some code, whether working or not. Flawed methodology? Probably. A more accurate statement might be the lack of any methodology at all.

I actually thought my original question was simple and easily understood. I have 10 images on a form. A user can select any combination of images, with #1 & #2 being required, and the selected 5 would appear on a report. That's it.

I will give your solution a go and I thank you for your effort in putting that together.
Nov 19 '11 #11
ADezii
8,834 Expert 8TB
Public Arrays can be a little tricky, so don't forget to Erase the Array at critical points, such as: the Close() Event of the Report, if > 5 Radio Buttons Selected along with the the resetting of these Buttons to False, etc. This is easily done via:
Expand|Select|Wrap|Line Numbers
  1. Erase astrImages
Nov 19 '11 #12
NeoPa
32,556 Expert Mod 16PB
It's not that the approach indicated by ADezii won't work. It's that it may not be an appropriate solution for this problem. As we don't know the problem clearly enough. If the data is bound data then this approach is inappropriate. I was leading you to that understanding (or trying).
Nov 20 '11 #13
tuxalot
200 100+
NeoPa and Adezii,

Thank you both for sticking with me, and pointing out flaws in my logic where appropriate. I truly appreciate your help. This is certainly an education. I have thought a bit more about this and I think some background might help clarify what I am trying to accomplish.

The db I am working on deals with machinery maintenance. The machinery has a set of maintenance procedures that are developed in the db. Various pieces of equipment are necessary to perform the maintenance. While developing the procedures, a user is presented with a set of pictures showing the types of equipment that might be necessary to perform the required maintenance. Not all pieces of equipment are used for every procedure. The user then selects the picture if that equipment is applicable to the maintenance operation.

Selecting the picture triggers a bound textbox below each picture to display the URL of an external image of the selected equipment. The textboxes are bound to my main table in columns E1 - E10. So the resulting columns might look like this:

Expand|Select|Wrap|Line Numbers
  1.  E1   E2   E3   E4   E5   E6   E7   E8   E9   E10
  2. urlE1     urlE3     urlE5     urlE7          urlE10     
  3.  
So up to this point all is working. I need help with the reporting.

My report is based on a query of the main table. I would like to have image controls on the report show the selected images in a single row, equally spaced. Below each picture will be a label with a description of the selected equipment and I suppose I can add an additional 10 bound fields in my table to capture those data.

I hope this better describes my needs. I realize your time is valuable and better spent helping folks with focused questions so I apologize for taking up your time previously.

Tux.
Nov 23 '11 #14
NeoPa
32,556 Expert Mod 16PB
That's a good job Tux. I'm sorry to say though, that this indicates a setup which seems so unnatural to me that I find I can't work within it without wanting to strip everything out and start again from scratch. I've spent a lot of time trying to find a way that I can help but everything I can think of turns out to be insupportable due to the structure of the design you have.

My instinct would be to design something that could be reported without the need to have the form open first (ADezii's quite clever solution uses information from the form to print the correct pictures onto the report).

If you want to design a report that can work generally from the data you have available then, yes - you've guessed it, you need to focus your thinking on the data you have available. Notice you haven't really presented the data structure yet. I suggest it's too late for that in this thread, but if you do take that course and get stuck, that's what you need to focus on and that's what you need to include in your question.

Best of luck.

PS. As your question stands, ADezii's post (#9) does answer it. It's not a solution I'd be too happy with myself, but that's down to the question rather than the answer.
Nov 23 '11 #15
tuxalot
200 100+
I'm sorry to say though, that this indicates a setup which seems so unnatural to me that I find I can't work within it without wanting to strip everything out and start again from scratch
The structure can certainly be modified. How would you do it?

My instinct would be to design something that could be reported without the need to have the form open first
The report uses a query as it's recordsource and the data (URL's) are stored in the table. The form does not need to be open for reporting.

As your question stands, ADezii's post (#9) does answer it.
You mentioned that if the data was bound, ADezii's solution may not be appropriate. As I mentioned in the last post, the data is bound.
Nov 23 '11 #16
NeoPa
32,556 Expert Mod 16PB
I've replied via PM as most of what I say is not really related to the question.
Nov 23 '11 #17

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

Similar topics

4
by: OutsiderJustice | last post by:
Hi All, I can not find any information if PHP support multi-thread (Posix thread) or not at all, can someone give out some information? Is it supported? If yes, where's the info? If no, is it...
37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
6
by: Joe | last post by:
I have 2 multi-list boxes, 1 displays course categories based on a table called CATEGORIES. This table has 2 fields CATEGORY_ID, CATEGORY_NAME The other multi-list box displays courses based on...
4
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
17
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, Wide character and multi-byte character are two popular encoding schemes on Windows. And wide character is using unicode encoding scheme. But each time I feel confused when...
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
2
by: Aussie Rules | last post by:
Hi, I have a site that Iwant to either display my text in english or french, based on the users prefernces ? I am new to webforms, but I know in winforms, this is pretty easy with a resource...
14
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
As far as I know, the C Standard has no mention of multi-threaded programming; it has no mention of how to achieve multi-threaded programming, nor does it mention whether the language or its...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.