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?
 
OddyWriterConnect With a Mentor Mr.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
 
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.