# Pulling Picture from Table Query into Picture Box on form

1. I made a few adjustments (integer to Long) to your SuperHeroes3 and ran the system through 10000 iterations.
2 separate runs of 10000 clicks. Attached are the results.

Shows some idea of the distribution of your "Randomness".
See the double click event on the Get btn--you could remove the constant or get/supply a different value.

Good luck and thanks for sharing.

After 4 runs of 10000 iterations - M 4 vs F 0--Men always win?????

2. Virtually Inert Person
Windows 10 Access 2016
Join Date
Jun 2014
Location
Posts
8,560
You are not using an "image" anything in your examples - you're using an attachment field. If you want to load images into a control via vba, then use an image control or maybe an unbound object control, not an attachment control. Why would I surmise that you know how to bind a form to anything when you don't provide any clues to that? People post complicated code that they got from somewhere all the time, thinking that is what they need when a simple bound form will do.

If I haven't already mentioned it, I would not store attachments in a table, hence I know little about that. I will leave this to others who do, and hopefully you'll get better assistance and be able to post your solution when you get one. As for the random expression, when I check it out, replacing id with numbers 1 through 4 I get very strange looking numbers
0.4704319
0.7347538
5.524743E-02
0.1781758

Maybe they're ok for whatever it is that you're really doing, because I suspect we don't know what that is.
Good luck!

3. joeyz,

I used my randomNumber function and ran it several times with this code as a test.

Code:
```Sub tR()
'using a random number to identify Male vs Female
'where an even number is used to increment Male count, and
' an odd number is used to increment Female count.

Dim i As Long, M As Long, F As Long
For i = 1 To 1000
If (randomNumber(1, 10000) Mod 2 = 0) Then  'even or odd
M = M + 1
Else
F = F + 1
End If
Next i
Debug.Print M & "   " & F
End Sub```
and got these results for M vs F randomness

Code:
```496   504
493   507
491   509
501   499
501   499
496   504
496   504
507   493
501   499```

I agree that using attachment or multi-valued fields is not something to be encouraged. There are established procedures/methods to achieve the same functionality, but M\$oft implanted them into Access for some reason.
Many think it was to attract/appease new users?? Most feel they contravene sound principles.

I don't use them, but some people do and post with related concerns. I have responded to a few more from interest and assistance rather than encouraging their use.
Last edited by orange; 05-18-2020 at 04:13 PM.

4. Novice
Windows 10 Access 2016
Join Date
May 2020
Posts
10
Great catches and feedback orange and your analysis on the number generator problems.

Been a long time since I coded in vba or anything else.

great stuff man!

5. Novice
Windows 10 Access 2016
Join Date
May 2020
Posts
10
Originally Posted by Micron
You are not using an "image" anything in your examples - you're using an attachment field. If you want to load images into a control via vba, then use an image control or maybe an unbound object control, not an attachment control. Why would I surmise that you know how to bind a form to anything when you don't provide any clues to that? People post complicated code that they got from somewhere all the time, thinking that is what they need when a simple bound form will do.

If I haven't already mentioned it, I would not store attachments in a table, hence I know little about that. I will leave this to others who do, and hopefully you'll get better assistance and be able to post your solution when you get one. As for the random expression, when I check it out, replacing id with numbers 1 through 4 I get very strange looking numbers
0.4704319
0.7347538
5.524743E-02
0.1781758

Maybe they're ok for whatever it is that you're really doing, because I suspect we don't know what that is.
Good luck!
Its all good Micron.

As I said, Since I couldn’t get image control to work, this was only a brute force work around.
An image is an image, representation of something, and it is pulling up into form nicely.
didn’t mean to over complicate things.
Hahahahaha

Page 2 of 2 First 12

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Other Forums: Microsoft Office Forums - Senior Forums