Access 2010 Form

I am running Access 2010. I have a text box in a form called "PictureLocation9" . On CLICK I wish to browse for a filename, select it and it to be recorded in my text field "PictureLocation9"

it might look like c:\pictures\ scene.jpg

Can someone give me the code to do this please. I am only learning, and cant find the code complete surfing the net
Topics:
Mark JohnstonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

OddyWriterMr.Commented:
Example file was uploaded per your request.
11-4-2017-8-40-26-AM.png
CustomerRecordE.accdb
0
Mark JohnstonAuthor Commented:
The outcome is not quite what I wanted Touch, I need the full path to show, and to launch it from clicking in a text box, eg "PictureLocation1" rather than a button. If i attached the data base could you alter it?
0
OddyWriterMr.Commented:
You can modify code by:
1. Add Event OnClick in your textbox with "GetFileName"
2. Modify Sub GetFileName in Line 15 by delete it.
Line 15..               fileName = Right(fileName, Len(fileName) - Len(CurrentProject.Path & "\Data\"))

This is idea.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Mark JohnstonAuthor Commented:
I am having trouble with altering it with a text box. The code I have is in the attached.I copied it and altered it accordingly, but getting an error
Database41.accdb
0
Mark JohnstonAuthor Commented:
My reference library (2010) doesn't have exactly the same options. See attached. If you can help me with this it would be really appreciated.

Many thanks
Acccess-2010-reference-library.JPG
0
Mark JohnstonAuthor Commented:
In the template you sent, it is not possible to view past entries. Do you know why? I am not ungrateful, but  I am no further ahead. Thanks for your time  Touch.
0
OddyWriterMr.Commented:
This is your modification file. Please study from it.

Problems, I found.
1. Add references was not completed.
2. Private Sub in the first line with sub in second line.
Database42.accdb
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mark JohnstonAuthor Commented:
I understand my syntax error now Touch. I thank you very much for your time and effort. Problem solved.
0
OddyWriterMr.Commented:
Sorry!

I forgot to tell you.
You have to create folder /data in the same folder of Database42.accdb
0
Mark JohnstonAuthor Commented:
I see that. Many thanks. If I want 3 picture with each record, what part of the code do I copy?
0
OddyWriterMr.Commented:
1. Add new text box
2. Add event:onclick same as the first textbox
0
Mark JohnstonAuthor Commented:
I have done that, and copied the code over, renamed appropriate code to suit, but it then throws up error messages on both text boxes.  I copied from

Private Sub txtPictureLocation_Click()
    GetFileName
    DoCmd.Save
End Sub

through to

Sub showErrorMessage()
End Sub

I changed any reference to txtPictureLocation to txtPictureLocation2 so it would match the text box name.  Spent ages trying to find the error. Sigh.......  I actually don't need the confirmation box.  Can you show me how to replicate one for me with a comment on where the copy starts and ends with. I think there is code  in there for a button click still?  What image is image20??   I know its time consuming, I am also happy to pay you via Paypal if that would  help.
PersonGallery.accdb
0
OddyWriterMr.Commented:
1. I actually don't need the confirmation box. It's MsgBox, Just delete it.
2. image20?? is name of your object image in form.

Actually, there is many ways to code with high eff. algorithm. But, this way in attached file should easy for you.

In attached, new 2 textboxs was added.
PersonGallery.accdb
0
Mark JohnstonAuthor Commented:
How good are you.... Thanks heaps. I have been up 16 hours, got to sleep... LOL. That is so good of you.

Cheers
Mark J
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.