Full Version: Change picture on load
UtterAccess Forums > Microsoft® Access > Access Forms
beckntrav
I have a continuous form and on each detail I have an image. I want to set an image to either visible or not visible based on the value of a text box on the form. The form is a continuous form that loads each record in a query.
irst of all, what should I use as a trigger? The form onload? Will that cycle through each detail?
Secondly, this is what I was thinking of using, or something else that works.
Private Sub Form_Load()
If stagedesc.Value = "post production" Then
imgStop.Visible = False
End If
End Sub
stagedesc is my text box
imgStop is the image
"post production" is the value in the text box.
My apologies if I missed this somewhere in teh forums, I couldn't find an example.
Bob_L
You can't set a control to be visible on one record and not on the next in a continous form. If you need that functionality you will need to use a SINGLE form format.
ChrisO
Don’t know if this will work in A2K7 but it does in A2K3.
No conditional formatting required, in can be run straight from a query.
2K3 demo attached.
Regards,
Chris.
Rainlover
Very clever.
assume this will be yet another addition to the code archives.
Oneeds some work as you can't add a new image.
Suggest a POP up form.
Also can you reproduce this in a Report.
DMax + 1
ChrisO
G’day Des.
Yes, reports can be built off the same query as the form uses but the report wizard does not seem to create the bound object frame correctly.
That will need to be done manually; the wizard creates a text box instead of a bound object frame.
The popup data entry form idea is good, much easier to control it with ULS.
(Don’t know if I’d put ULS in a demo though, just complicates matters.)
Code archive?
a.
Possibly; but need to think about how best to present it for the members consumption.
For example; what general criteria should be used and where to derive that criteria?
(Not good to have static criteria in the query, least not for code archive demos.)
Could derive the criteria from an open form, I guess, but that requires the form to be open even for the report to operate...messy.
Perhaps the most flexible method would be for the form to write the SQL, of the query, back to the query.
That way the report should continue to operate on the last write to the query, whether the form is open or not.
b.
Needs to be back written to Access 97 (some people do still use it grin.gif ) and it precludes simple conditional formatting.
The current attachment does not require conditional formatting for the image but a demo may need to hide other information, or at least gray it out.
c.
Another post to the code archive requires another post to the code review forum.
I’ve got two there already and don’t want to hog it.
d.
But I will work on it.
Regards,
Chris.
mishej
Access (or more correctly the Jet database engine) does not use/understand/handle Triggers.
ontinuous forms are a great tool for one-to-many tables but limited.
THere is how I solved a similar problem:
http://www.tigeronomy.com/Downloads.aspx#link_imageSubForm
ChrisO
Nice John, very nice.

Your form seems to be in Single Form mode but I was intending to try and do it in, A97, Continuous Forms view and also for a Report.

The reason being is to not restrict the number of ‘Detail’ entries to a finite value.
(I know it will bloat the database, to some degree shrug.gif , but I’ll leave that point up to the end user on how many they wish to insert.)

Olove your idea of a composite image and then the breakdown parts you have done. thumbup.gif

Kind regards,
Chris.
Edited by: ChrisO on Thu May 28 2:29:17 EDT 2009.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.