Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-14-2019, 01:59 AM   #1
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
image viewing in a form

Morning all,

OK, my searchable image database is coming along thanks to advice and a sample database from this forum, and I have worked out how to show an image path on my computer for each part in the table.

What I want to be able to do next, in my search results form, is to be able to click on the path (as a hyperlink) and have the image show in an imagebox on the same form. The image should change as I click on different images.

Is this possible? Are hyperlinks the wrong way to go?

many thanks as always,
Chris

ChrisC is offline   Reply With Quote
Old 08-14-2019, 02:18 AM   #2
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,595
Thanks: 59
Thanked 2,435 Times in 2,335 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: image viewing in a form

just add the path of the image (saved on fieldname) to the Picture property of the image.
don't use Click event instead use Dbl-Click event of the textbox.

Me.Image0.Picture = Me.imagePathFieldName
__________________
"Never stop learning, because life never stops teaching"
arnelgp is online now   Reply With Quote
Old 08-14-2019, 03:09 AM   #3
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: image viewing in a form

Use a text field for the path. Hyperlink datatype can cause problems.

Agree with arnelgp.
The reason for using the double click event is so you can if necessary select the item for editing using a single click.
However the sample database I supplied in your earlier thread should have shown you how to do this.

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 08-14-2019, 03:39 AM   #4
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: image viewing in a form

Thanks folks!

so to get it right in my head:

I have a picture box simply called "ImageBox"
I have my text field that contains the image path which is called "ImageFile", which is called from my main item table and appears


The code therefore that I put in the On Dbl Click property of the ImageFile text box would be:

Me.ImageBox.Picture = Me.ImageFile

?

When I double click on it however, I get the error message pop up to say that the database "cannot find the object 'Me'".

sorry to be dumb on what is almost certainly a simple thing!
ChrisC is offline   Reply With Quote
Old 08-14-2019, 03:41 AM   #5
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: image viewing in a form

You need to refer to the name of your textbox control which may not be the same as the field name
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 08-14-2019, 03:53 AM   #6
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: image viewing in a form

Hi Colin,

text box name and control source are both "ImageFile".

could this be causing some kind of conflict?

thanks
ChrisC is offline   Reply With Quote
Old 08-14-2019, 04:00 AM   #7
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: image viewing in a form

It shouldn't cause a conflict.
The Me. syntax only works on the same form but that's not an issue here.
There must be something else that's not quite right on your form.

As a test add another text box temporarily and set its value equal to me.imagefile. Does that error?

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 08-14-2019, 05:57 AM   #8
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: image viewing in a form

didn't do anything im afraid (although I wouldn't rule out me doing it wrong!!)

ive attached the db - as you will see, it is an amended version of Allen Brownes.

the existing image is simply a place holder.


EDIT - I did try to attached the DB, but for some reason it is over 10mb, despite having only 8 product lines in it and the only image (the place holder) is only 500kb. I will have a play around and will return!
ChrisC is offline   Reply With Quote
Old 08-14-2019, 06:09 AM   #9
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: image viewing in a form

DB now a "better" size and attached!
Attached Files
File Type: accdb Parts Catalogue 3.02.accdb (636.0 KB, 2 views)
ChrisC is offline   Reply With Quote
Old 08-14-2019, 06:33 AM   #10
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: image viewing in a form

Always compact & zip before uploading

You did do it wrong. You should have created an event procedure for the double click event:

Code:
Private Sub ImageFile_DblClick(Cancel As Integer)
    Me.ImageBox.Picture = Me.ImageFile
End Sub
See attached & check if it now works.
BTW I recommend NOT using jpg images. These don't always work well with Access. PNG format is much better
Attached Files
File Type: zip Parts Catalogue 3.02.zip (37.2 KB, 3 views)
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 08-14-2019, 06:45 AM   #11
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: image viewing in a form

You Sir, are a genius. thank you!

So for my understanding, for this type of thing (i.e. updating of fields) would it always (or at least most of the time) need to be done through an event procedure?

it works perfectly - thank you again.

Chris
ChrisC is offline   Reply With Quote
Old 08-14-2019, 07:55 AM   #12
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: image viewing in a form

Yes!
There are some things you can place directly in the property sheet but not what you attempted
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
ChrisC (08-14-2019)
Old 08-14-2019, 11:02 PM   #13
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: image viewing in a form

excellent, thanks very much for your help.

solved!
ChrisC is offline   Reply With Quote
Old 08-14-2019, 11:48 PM   #14
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: image viewing in a form

You're welcome. Good luck with the rest of your project

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question Editing, Viewing Toolbars, Viewing "Access Options", etc... skilche1 General 2 06-17-2009 08:07 AM
Viewing a form BlueBug Forms 4 05-08-2007 06:22 PM
Viewing HTML in a form davec69 Forms 3 09-05-2006 12:19 PM
click image hyperlink in form to load image to form 99shassan Forms 1 06-16-2006 04:48 AM
Viewing (.pdf, .doc, etc) within form Dimples Forms 0 08-23-2005 04:00 AM




All times are GMT -8. The time now is 01:08 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World