Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Randomly display several table pictures on a Form

Status
Not open for further replies.

LakotaMan

Instructor
Aug 21, 2001
240
US
I don’t even know if this can be done, but here goes:
Using Access 2007, I have a table of playing cards, and am using an attachment field to show their images on a conventional bound form. And all is working well with this.
Now, I am trying to lay out an unbound form upon which I want to randomly display several images of the cards in different positions, with textboxes showing their card names next to them. I have been using a command button to run code that picks random card names from my table and displays them in textboxes, but I haven’t been able to figure out how to display the corresponding pictures.
For what it’s worth, here’s the code I’m using to randomize the various textboxes (I’m only working with a couple until I can figure this out):
Code:
Private Sub cmdNewLayout_Click()
    Me.txtPos1 = Int((78 - 1 + 1) * Rnd + 1)
    Me.txtPos2 = Int((78 - 1 + 1) * Rnd + 1)
Me.txtCard1 = DLookup("CardName", "qryCardMeanings-Base", "CardID=" &  me.txtPos1)
Me.txtCard1Suit = DLookup("Suit", "qryCardMeanings-Base", "CardID=" & me.txtPos1)
Me.txtCard2 = DLookup("CardName", "qryCardMeanings-Base", "CardID=" & me.txtPos2)
Me.txtCard2Suit = DLookup("Suit", "qryCardMeanings-Base", "CardID=" & me.txtPos2)
End Sub
I hope I’ve told you everything you need to know. There isn’t much more to the app.
Any help you can give me will be greatly appreciated.
LM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top