Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    2,248

    Please have a look at the attached file You will need to update the PhotoName field to add a few record with your own file names. When you open the form it will always open at PhotoId =3 (or whatever you set it to be).

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  2. #17
    RedEyes is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    14
    I put the dLookup right under the Dim statement in your block of code and now it just go right on through with no errors. The bad part is it still doesn't default to 3331.
    Just to see if the code was even being read I removed just the PhotoID number 3331 and I crashed on open. The only way to get the PhotoID 3331 or any ID to show up on Form open
    is to hard code it the Query "=3331" that works real good. Ha Ha. Just wondering, at one point while I was in the Query I clicked on the Run ! and what I saw in the pop up Recordset was the field for
    the Randomized PhotoID was something like 0.34852123260498 and that ID represented record IMG_0223.jpg all random ID are like that. Don't know if thats' a problem or not because photo on the Form matches
    the Text Box that shows the PhotoID.

  3. #18
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    2,248
    Please have a look at the sample I gave you, specifically the query. You see that I'm sorting on the randomizer field but I also return the original PhotoId. The code in the form does not need the dlookup, only the latest piece I gave you, the idea is to lookup the record with PhotoId=3331 and load it first. The query must contain all records, do not limit it to one.

  4. #19
    RedEyes is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    14
    It's Working! I looked at your Database and it was working every time then I looked in the Query at the Random field, totally different. So I copied it and placed it in my Query and every time my form opens to PhotoID 3331.

  5. #20
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    2,248
    Good job!
    Cheers,

  6. #21
    RedEyes is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    14
    No! All the Cheers go to you Pal. I can't thank you enough.

    My next VBA Chapter is going to be how to use Randomize.

    Thank you again Gicu.

    RedEyes
    Headed for the Visine bottle.

  7. #22
    RedEyes is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    14
    Gicu, I can send you a copy of my database if you want, you can throw it in your trophy folder.

  8. #23
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    2,248
    You're very welcome!

    Good luck with you project!

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 09-18-2020, 09:06 PM
  2. Replies: 5
    Last Post: 07-10-2020, 12:41 PM
  3. Replies: 10
    Last Post: 02-25-2019, 07:36 PM
  4. Replies: 2
    Last Post: 03-14-2018, 11:10 AM
  5. Replies: 0
    Last Post: 09-28-2015, 10:10 PM

Tags for this Thread

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