Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    14,822
    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?????
    Attached Thumbnails Attached Thumbnails Super10000.PNG   Another10000.PNG  
    Attached Files Attached Files

  2. #17
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    7,045
    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. #18
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    14,822
    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. #19
    joeyz is offline 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. #20
    joeyz is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    10
    Quote Originally Posted by Micron View Post
    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.

    task is simple, make program in access to randomly pull up images stored in access database.
    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 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 12-17-2017, 12:33 PM
  2. Query Help (picture)
    By cmf0106 in forum Access
    Replies: 1
    Last Post: 03-10-2013, 01:28 AM
  3. Replies: 2
    Last Post: 09-02-2011, 09:16 AM
  4. Replies: 1
    Last Post: 11-02-2010, 03:35 PM
  5. Can't Load a picture from the table
    By dada in forum Reports
    Replies: 1
    Last Post: 09-18-2010, 10:17 AM

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