November 30th, 2012, 10:27 AM
Appending a value from one field to another
I have a form which has a field called "txtImageName" with a default value which will be a UNC path to a network folder.
I want to append to this path a value that is entered in another field called "Username". How do I go about doing this?
Also I'd like to be able to hide the network path from view, showing only the filename in the "txtImageName" field if possible.
November 30th, 2012, 06:54 PM
Set the visible property of the [txtImageName] field to no, should hide the field.
me.txtImagename = me.txtImagename & me.username
To display just the field name, it would help to know more about the full string you're using for the network path. Is it always the same path? How is the file name determined? is it input by the user, or does the database assign the name itself?
November 30th, 2012, 07:19 PM
What version of Access are you using? Are you trying to dynamically display images with records?
Access 2007 introduced ControlSource property to Image control. Are you using Image control?
December 1st, 2012, 10:48 AM
Brilliant thanks meratigoerr. I've amended it slightly as the images will always be held in the same location so now have
as an After Update event on the "Username" field which is now appending the value entered here to the end of the defined network path into the txtImageName field as I wanted. Thanks again....How can I thank you on the post as there doesn't appear to be a star at the bottom of the post frame!?
Me.txtImageName = "\\servername\share\pictures\" & Me.Username & ".jpg"
I didn't mean hide the txtImageName field, I meant hide the network path shown in this field so that only the filename that's getting appended appears!
@June7: I already have an Image Frame with a control source reading from the txtImageName so wanted to auto-populate the field based on the username which is also the same name as the image that will be stored on the network drive.