Access Shell (1 Viewer)

MannyST

Member
Local time
Today, 18:02
Joined
May 23, 2020
Messages
42
Hi first timer here......my knowledge of Access is fair, but i'm getting deeper into vba and it's a huge challenge as I don't have a real good foundation or understanding of the why is something written sometimes. Especially with a Shell function that I discovered I will need to use to accomplish my next task in a major project I am trying to work out. So my goal is the use a Table A in access which has jpg image file names. Those files are in a separate folder. I want to then create a form based of table a to have hyperlinks to the corresponding .jpg files in said folder. the following is what I discovered but as I said the lack of foundation is poor. I tried searching and taking each part to get a better understanding to put it all together, but have been going in circles all day with searches and examples. Are there any good videos to watch to see someone build and execute? This would help a great deal as I'm more of a hands on learner. If anyone can elaborate on the following that would also help to guide me in completing shell function and then seeing exactly how it works to get a better understanding.
Dim x As Variant
Dim Path As String
Dim File As String
Path = "C:\Program Files(x86)\Microsoft Office\root\Office16\MSACCESS.EXE"
File = "C:\Mohawk\00532_10045_060084.JPG"
x = Shell(Path + " " + File, vbNormalFocus)

the Path & File are actual on my computer. The x = Shell(Path......as I said poor foundation and I know what vbNormalFocus is but before that...I lost....Any Help? thanks
 

June7

AWF VIP
Local time
Today, 14:02
Joined
Mar 9, 2014
Messages
5,423
Code obtained from https://stackoverflow.com/questions...-and-creating-hyperlinks-to/61962493#61962493

I found those bits and pieces from various blogs and forum posts. I don't know of any tutorials that could fully explain the code nor how to apply it in your app. I have on occasion employed found code without fully understanding it. If I couldn't plagiarize I would be lost.

That Shell code was only one option provided. There is simpler code to accomplish what you want. I even added a 4th option since you read that answer.

You need to decide how you want to employ it. Do you want user to click a button on form that will open image path from current record? So your first step is to get a basic understanding of how to create a procedure in VBA and learn VBA language and syntax. If you already have basic programming skills, this should not be so difficult. Start with https://support.office.com/en-us/ar...gramming-92eb616b-3204-4121-9277-70649e33be4f
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 15:02
Joined
Oct 29, 2018
Messages
21,358
Hi. Welcome to AWF!

Have you tried using Application.FollowHyperlink first?
 

June7

AWF VIP
Local time
Today, 14:02
Joined
Mar 9, 2014
Messages
5,423
One of 4 options suggested in referenced link.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:02
Joined
Oct 29, 2018
Messages
21,358
One of 4 options suggested in referenced link.
I just missed your post by a few seconds. It wasn't there yet when I was composing my post. Sorry for the duplicate info.
 

MannyST

Member
Local time
Today, 18:02
Joined
May 23, 2020
Messages
42
One of 4 options suggested in referenced link.
I took a quick look at the programming link and scrolled through real quick, alot is familiar, but I will take another look tom.
 

June7

AWF VIP
Local time
Today, 14:02
Joined
Mar 9, 2014
Messages
5,423
I just missed your post by a few seconds. It wasn't there yet when I was composing my post. Sorry for the duplicate info.
No need to appologize. Happens to me all the time. I should have just waited for you to "catch up".;)

See how easy it is to create a VBA procedure - review http://www.baldyweb.com/FirstVBA.htm. That is creating event procedure behind form or report object. Some procedures must be placed in a general module which you would create in the VBA Editor which can be opened from ribbon.

And I just became aware that your code is trying to use Access to open a jpg file. Why would you expect that to be possible with this code? If you want to display image within Access that involves an Image control. If you want to view jpg externally, that will require an image viewer app. Of the 4 code examples provided in other thread, 2 of them simply open file in app that your system has designated as default for that file type. With the other 2 methods you can specify app appropriate for the file type.
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 22:02
Joined
Jan 14, 2017
Messages
18,186
See if my example app helps:

For info, JPG images don't always work well in Access due to their lossy nature. PNG files are usually a better option.
 

MannyST

Member
Local time
Today, 18:02
Joined
May 23, 2020
Messages
42
Hi. Welcome to AWF!

Have you tried using Application.FollowHyperlink first?
I read about that, but I believe the Gohyperlink is a better one ..............thanks for the response
 

MannyST

Member
Local time
Today, 18:02
Joined
May 23, 2020
Messages
42
I appreciate everyone responding and I will def read everything and see what I can put together.

Let me give you the actual scenario as June7 just realized i'm trying to use Access to open images. Here we go hopefully not to long. I receive a data file of numerous items, I import into an access file/do numerous qry functions/qry append to get into final format. Within that file is a column name Product Image file exists. It is the actual image for the item. There are thousands of records/items and therefor thousands of pictures/.jpg. JPG is the format that is provided. Within that record are blank fields that shouldn't be blank and using the picture will help populate that data for a final product. The pictures provided will be stored in a separate file using the same file name as what is is the table already. Primary key is different than Product image file column. Records will have a one to many relationship with pictures as multiple pictures are used for different items. I will build a form within access to work each record and fill in the blank fields. This is where I need to know, how to be in the form and have a hyperlink or something where it will go call up the product image file for that record and open it so I can see picture and fill in the blanks. These pictures are also formatted in Cloudinary, but that is another task. I'd like the average person who is more familiar with files and links to be able to clink on link fill in blanks and move on to the next record. Once I figure this out, the pictures will get stored on a server, which might be faster when opening them up? I figured out how to do one picture at a time and also inserting paths, etc, but the time it would take to do 25,000 pictures would be insane. So I hope that helps clarify the process. Ideas?
 

MannyST

Member
Local time
Today, 18:02
Joined
May 23, 2020
Messages
42
What if I started with just the large folder of pictures files and imported them into a table and then created a hyperlink to open those pictures in whatever file the were in??? I could then link the picture table to the table I work out of and the add the hyperlink field that will call up the picture???? Am I going in the wrong direction? I think if I can figure out how to take 25,000 files(jpg) format/script/vba to be able to produce a list/table that has hyperlinks to those pictures in ACCESS I will be able to put the rest together.....
 

jdraw

Super Moderator
Staff member
Local time
Today, 18:02
Joined
Jan 23, 2006
Messages
15,364
I 'd step back and identify the big picture.
Seems you have ~25000 images that you need to record and associate with some product/item. The relationship may not be 1:1.
There seems to be some properties/attributes of the image that will have to be added manually. But we don't know what these are; can they be categorized and approached in a systematic/programmatic manner...
I recall a project many years ago where an organization had an inventory of photographs (digital images). These were photos related to Tourism and the intended use was to supply/charge for these as stock photos. The usage and selection involved such things as
-scenic rural/urban
-include/exclude people
-seascape/landscape/cityscape
-season of the year
-time of day/night
-political/non political connotation
-event related/newsworthy
and many more including some ability to include new categories....

Here's a sample of subcategories within Boats.
sampleCategories.PNG


Much of the effort is in analyzing the requirement; creating a sample data model; testing and revising the model; pilot project to show the design and functionality to focus groups for critique;..
Once approved, then develop the database/application.

It isn't clear where Cloudinary fits. Nor what info is included with the image or its EXIF/IPTC. Who will be using the application.
 
Last edited:

MannyST

Member
Local time
Today, 18:02
Joined
May 23, 2020
Messages
42
I 'd step back and identify the big picture.
Seems you have ~25000 images that you need to record and associate with some product/item. The relationship may not be 1:1.
There seems to be some properties/attributes of the image that will have to be added manually. But we don't know what these are; can they be categorized and approached in a systematic/programmatic manner...
I recall a project many years ago where an organization had an inventory of photographs (digital images). These were photos related to Tourism and the intended use was to supply/charge for these as stock photos. The usage and selection involved such things as
-scenic rural/urban
-include/exclude people
-seascape/landscape/cityscape
-season of the year
-time of day/night
-political/non political connotation
-event related/newsworthy
and many more including some ability to include new categories....

Much of the effort is in analyzing the requirement; creating a sample data model; testing and revising the model; pilot project to show the design and functionality to focus groups for critique;..
Once approved, then develop the database/application.

It isn't clear where Cloudinary fits. Nor what info is included with the image or its EXIF/IPTC. Who will be using the application.
Thanks, So Cloudinary isn't in the picture at the moment....so let's table that one. I want anyone to be able to open a form using access for right now. Once form is open there will be fields that are empty and need to be populated with data. A picture will be needed to popluate that data. We don't need the images in Access, we just need to be able to click on a link/hyperlink to where said picture is stored. Pictures will be stored for now on a C:\Pic File\Purple and so on for different colors let's say. So those pics need to be link to correct record that someone is working on in said form from within Access. I need to figure out how to take the picture file and turn/import that folder list into Access???? that will then create links that can be clicked on to those pictures. Is there a VBA code that can be inserted into Form that can call up appropriate picture where file name matches? That is what I'm trying to accomplish in some form or fashion....thanks for the response.....
 

jdraw

Super Moderator
Staff member
Local time
Today, 18:02
Joined
Jan 23, 2006
Messages
15,364
Once form is open there will be fields that are empty and need to be populated with data. A picture will be needed to popluate that data.
Suggest you give us a sample of a least 1 record.

What is the source of the form?
What are the fields that need populating? Where do the values originate? Do you have a list of standard terms/values?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:02
Joined
Oct 29, 2018
Messages
21,358
Thanks, So Cloudinary isn't in the picture at the moment....so let's table that one. I want anyone to be able to open a form using access for right now. Once form is open there will be fields that are empty and need to be populated with data. A picture will be needed to popluate that data. We don't need the images in Access, we just need to be able to click on a link/hyperlink to where said picture is stored. Pictures will be stored for now on a C:\Pic File\Purple and so on for different colors let's say. So those pics need to be link to correct record that someone is working on in said form from within Access. I need to figure out how to take the picture file and turn/import that folder list into Access???? that will then create links that can be clicked on to those pictures. Is there a VBA code that can be inserted into Form that can call up appropriate picture where file name matches? That is what I'm trying to accomplish in some form or fashion....thanks for the response.....
Hi. I haven't looked at Colin's demo, but have you considered using an image control to display the image rather than opening it? It sounds like you could use a subform for your images rather than have the user click on a link to view the images.
 
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 18:02
Joined
Jan 23, 2006
Messages
15,364
There is a sample (empty database) at Boyd Trimmell's site that may offer some ideas. It is older (mdb), and uses the Shell rather than FollowHyperlink. My undertanding is that you want to be able to display an image, and fill in a form. It is the form fields, underlying table(s) and relationships that require analysis and design. The ability to display an image on a form with image control is quite common.
 

June7

AWF VIP
Local time
Today, 14:02
Joined
Mar 9, 2014
Messages
5,423
Post #7 suggested an image control.

Do you want to open image externally in an image viewer app or do you want to open it within a form inside Access? I asked this question a long, long time ago and the response was opting for external viewing.

Opening image on a form is really quite simple with an Image control. Review https://www.accessforums.net/showthread.php?t=73766

Importing images into table is an option but not one I usually choose. Images use up Access 2GB size limit. So only do this if you do not expect file to grow.
 
Last edited:

MannyST

Member
Local time
Today, 18:02
Joined
May 23, 2020
Messages
42
Yes I agree and said yes to external app to open images. No putting images in access very bad and will bog functions down.
So I would ask if you can explain how we take all the files from picture folder and somehow convert them into a hyperlink where only hyperling/path of file would be in access table that would appear in form once I design using an action button in form so you can call up image in external viewer and be able to see pic so you can fill in blanks fields in form if any.

The goal is to create a table=done append data from original source file to table fields=done, run queries and do mapping to normalize data that will be used on a website=done...goal create a form so someone with less knowledge than myself can open form see if any blank fields that need to be filled in, if so they will need to call up image that matches record. The images in separate folder have a file name that is also in the table that form is created from. So between the file name of image in separate folder and the same name of file image in table this should help ensure image is matched to record being viewed in form? I get data that has missing info in many fields that need to be filled in in one file. And all the pictures that go-to those records in another folder. The goal is to marry two as I described above on a continual basis moving forward to populate empty fields before that record is used on a website...but in access lol.........make more sense?
 

June7

AWF VIP
Local time
Today, 14:02
Joined
Mar 9, 2014
Messages
5,423
Sounds like you already have a table with a field that has image path (or at least just image name) stored as a text string. If not, code can loop through files of a Windows folder and grab each file path and/or name and save it into text field. Then later you can use FollowHyperlink to open that image in viewer or use Image control to view image on report or form.

I would use Image control on form. I provided you a link to thread describing how that can be done. Post #17 of that thread has specifics. Rest of that thread just has other info of interest.

If you want to provide a sample of your data, follow instructions at bottom of my post.
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 15:02
Joined
Oct 29, 2018
Messages
21,358
Yes I agree and said yes to external app to open images. No putting images in access very bad and will bog functions down.
So I would ask if you can explain how we take all the files from picture folder and somehow convert them into a hyperlink where only hyperling/path of file would be in access table that would appear in form once I design using an action button in form so you can call up image in external viewer and be able to see pic so you can fill in blanks fields in form if any.

The goal is to create a table=done append data from original source file to table fields=done, run queries and do mapping to normalize data that will be used on a website=done...goal create a form so someone with less knowledge than myself can open form see if any blank fields that need to be filled in, if so they will need to call up image that matches record. The images in separate folder have a file name that is also in the table that form is created from. So between the file name of image in separate folder and the same name of file image in table this should help ensure image is matched to record being viewed in form? I get data that has missing info in many fields that need to be filled in in one file. And all the pictures that go-to those records in another folder. The goal is to marry two as I described above on a continual basis moving forward to populate empty fields before that record is used on a website...but in access lol.........make more sense?
Hi. I'm not trying to change your mind and have no problem with you continuing with your chosen course of action, but I would just like to voice my opinion regarding your comment about displaying the images in an Access form will "bog down" the process. I wasn't saying you store the images in Access, merely display them. I don't think doing so will bog down your application much. Cheers!
 

Users who are viewing this thread

Top Bottom