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,
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,
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.
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.
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.
Good job!
Cheers,
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.
Gicu, I can send you a copy of my database if you want, you can throw it in your trophy folder.
You're very welcome!
Good luck with you project!
Cheers,