Solved Image based on two text boxes (1 Viewer)

murray83

Games Collector
Local time
Today, 10:22
Joined
Mar 31, 2017
Messages
728
I may have asked this before in the past but have searched and cant find such a question, so here i go

i have my quiz which is fine, one life line is called 'Ask Kev' which is used once a game and tells the player the right answer at current it displays the text, but i would like the possibility to show a picture as some times the picture may have been cropped for the question

example is attached and the form which this should work on is F_AskKev

thanks for looking and reading this

Having trouble uploading as DB to big so will try and trim it some more tomorrow, can someone remind me what are the limits
 

jdraw

Super Moderator
Staff member
Local time
Today, 05:22
Joined
Jan 23, 2006
Messages
15,378
When attaching, Do a compact and Repair, then zip the database.
 

murray83

Games Collector
Local time
Today, 10:22
Joined
Mar 31, 2017
Messages
728
i did but still 8 meg :(
 

murray83

Games Collector
Local time
Today, 10:22
Joined
Mar 31, 2017
Messages
728
this is the code i tried and just get blank

so when the two match it should show what ever is in AskKevImage

Code:
Me![QImage].Picture = DLookup("[tblQuestions]", "[AskKevImage]", "QuizNumberLookup=[QRoundNo] AND QuestionNoLookup=[QuestionNo]")
 

Micron

AWF VIP
Local time
Today, 05:22
Joined
Oct 20, 2018
Messages
3,478
You db size problem is probably due to images store in tables? Picture path is usually a better method. Regardless, you need to concatenate when using fields or control names in expressions. You don't have a value of "[QRoundNo]" in the field, right? Try something like

Me.[QImage].Picture = DLookup("[tblQuestions]", "[AskKevImage]", "QuizNumberLookup=" & [QRoundNo] & " AND QuestionNoLookup=" & [QuestionNo] & """)

At the moment I can't recall if you need 3 or 4 " at the end (or what) where I have 3.
 

murray83

Games Collector
Local time
Today, 10:22
Joined
Mar 31, 2017
Messages
728
You db size problem is probably due to images store in tables? Picture path is usually a better method. Regardless, you need to concatenate when using fields or control names in expressions. You don't have a value of "[QRoundNo]" in the field, right? Try something like

Me.[QImage].Picture = DLookup("[tblQuestions]", "[AskKevImage]", "QuizNumberLookup=" & [QRoundNo] & " AND QuestionNoLookup=" & [QuestionNo] & """)

At the moment I can't recall if you need 3 or 4 " at the end (or what) where I have 3.

cheers it was 4 but i have tried and keep getting this error
 

Attachments

  • 1.jpg
    1.jpg
    45.9 KB · Views: 83
  • 2.jpg
    2.jpg
    32.3 KB · Views: 75

Micron

AWF VIP
Local time
Today, 05:22
Joined
Oct 20, 2018
Messages
3,478
If you can insert images rather than attach them that would be better. It seems that the new forum opens a browser tab (I'm using FF) and then I can't get back to this page. I have to go right back to my email to reload your post. Anyway, they don't help. If the field can't be found, check the spelling carefully. It makes no sense to me to requery a form or its controls in the Load event. That's when records get loaded according to the form recordsource property. You're just repeating whatever that is.
Also, please don't post code in pictures. Use code tags around the code text in your post.
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:22
Joined
Sep 21, 2011
Messages
14,267
cheers it was 4 but i have tried and keep getting this error
Do yourself a favour.

Put your criteria into a separate string variable and Debug.Print that before trying to use the criteria.?
 

murray83

Games Collector
Local time
Today, 10:22
Joined
Mar 31, 2017
Messages
728
cheers for hints but i fixed it by having the previous form having a dlookup and then adding it to the table and then the AskKev form looks up all good
 

Users who are viewing this thread

Top Bottom