[AccessD] Hide and show image

David & Joanne Gould dajomigo at tpg.com.au
Sun Mar 26 20:59:14 CST 2006


Darren

I've solved it using Jim's solution on the report but am still curious as 
to how you could programmatically enter an image into an image field in the 
table.

David

At 10:09 PM 25/03/2006, you wrote:
>Hi David
>Either will work -
>That code (That Jim described) will work  on a report or on a form
>Lets assume you have a form and You want to show the image based on the 
>value in
>the checkbox
>Lets assume the wheelchair image is called imgWheelChair
>Lets assume the checkbox is called chkHasWheelChairAccess
>
>Put the image on the form and make it hidden (Visible = false)
>Create a little function
>Call it say...
>ps_SetWheelChairImage and - Put it in the code behind the form up near the bit
>that says Option Explicit
>Copy and paste this
>
>Private sub ps_SetWheelChairImage()
>
>         If me.chkHasWheelChairAccess = -1 then ' Does have a tick in the box
>                 me.imgWheelChair.visible = true 'so show the image
>         else ' there is no tick
>                 me.imgWheelChair.visible = false 'Don't show the image
>         end if
>End sub
>
>
>Then in the ON_Current of the form have this
>
>ps_SetWheelChairImage()
>
>And in the OnClick of the textbox put...
>
>ps_SetWheelChairImage()
>
>That should sort out the form
>
>
>For the report
>
>Let's assume the image is in the detail section
>Let's assume the Field in the table that holds the tick is Calle HasWCAccess
>Let's assume it is in the record source of the report
>Make sure the property sheet is visible (That's the one with the tabs called
>Format, Data, Event, Other and All)
>In design view there is a horizontal greay bar going all the way across the
>screen called 'Detail'
>Click it and then click on the Event tab of the property sheet
>Then in the code behind the OnFormat have similar code
>
>If me.HasWCAccess =-1 then
>         me.chkHasWheelChairAccess.visible = true
>Else
>         me.chkHasWheelChairAccess.visible = False
>End if
>
>
>Phew sounds like a lot
>But is simple
>
>Lemme know off list if you're still aving trouble and I'll knock up a demo
>
>Hope this helps
>
>See ya
>
>
>
>Darren
>------------------------------
>T: 0424 696 433
>
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David & Joanne 
>Gould
>Sent: Saturday, 25 March 2006 9:09 AM
>To: Access Developers discussion and problem solving
>Subject: Re: [AccessD] Hide and show image
>
>Jim
>
>Thanks for you quick response.
>
>Are you talking about the report or the form?
>
>If the report, where do I put code as I couldn't find anywhere for it?
>
>If the form, how do I store the image into the table?
>
>TIA
>
>David
>
>At 08:42 AM 25/03/2006, you wrote:
> >David,
> >WI would use the image control with the picture of the wheelchair
> >(bmp).  The image control can be scaled to the size you need. Just make
> >sure the Size Mode is set to Zoom.  Then use code to hide or unhide the
> >image control as needed using the docmd visible command.
> >For example:
> >On the after update event of the checkbox use a simple if statement.
> >
> >         If Check6 = 0 Then
> >                 Me.Image5.Visible = False
> >         Else
> >                 Me.Image5.Visible = True
> >         End If
> >
> >Then when it's checked the Wheelchair will show, unchecked the image is
> >not shown.
> >
> >HTH
> >
> >Jim
> >jhewson at karta.com
> >
> >-----Original Message-----
> >From: accessd-bounces at databaseadvisors.com
> >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David &
> >Joanne Gould
> >Sent: Friday, March 24, 2006 3:29 PM
> >To: Access Developers discussion and problem solving
> >Subject: [AccessD] Hide and show image
> >
> >
> >A database has a check box in its table/form for whether a certain
> >location has wheelchair access or not. If it does have wheelchair
> >access, then on a listing report, the usual wheelchair symbol is to be
> >displayed next to its address. If it doesn't have access, a symbol is not
>displayed.
> >
> >1. Can this be done and if so how? I couldn't find anywhere to set the code.
> >2. The only option I could think of was to actually store the image in
> >the table with the user having to manually insert the image into the
> >field. Can the insertion be automated based on their choice at the checkbox?
> >
> >TIA
> >
> >David
> >
> >
> >--
> >AccessD mailing list
> >AccessD at databaseadvisors.com
> >http://databaseadvisors.com/mailman/listinfo/accessd
> >Website: http://www.databaseadvisors.com
> >--
> >AccessD mailing list
> >AccessD at databaseadvisors.com
> >http://databaseadvisors.com/mailman/listinfo/accessd
> >Website: http://www.databaseadvisors.com
>
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com





More information about the AccessD mailing list