Utilizing data on one field to display in another

david412

New member
Local time
Today, 10:38
Joined
Jan 12, 2006
Messages
8
Hello...

I have the following code that prompts a user to enter some data (typically something like: 11-22201 and a message will appear: RS1122201-01.jpg. I think the code is pretty much self explanatory... I have two separate fields one that that holds numbers like 11-22201 (different per each record) and another that I would like the RS1122201-01.jpg to be displayed in.

I have about 2000 records. Is there a way to manupilate this code to my advantage, so that it will do it for the entire table in seconds?
Thanks in advance.

Code:
Private Sub what()
Dim st$
Dim begin$
Dim endp$

st$ = InputBox("enter text")
st$ = Replace(st$, "-", "", 1, 1)
begin$ = "P:\RS"

last$ = "-01.JPG"
Endphrase$ = Mid(st$, 1)

st$ = begin$ & Endphrase$ & endp$
MsgBox st$

End Sub
 
I would just turn it into a function and call it whenever I wanted to display the second version.

Peter
 
Thanks for the response...but, I am not sure how I would call on one field's content and run a function so that the output(result) of that function will be displayed on another field.:(

Your help is very appreciated.
 
Code:
 Function FunGetPic(strIn As String) As String
    FunGetPic = "RS" & Replace(strIn, "-", "") & "-01.JPG"
End Function

This does what you described rather than what your code does :)

To use it in a field just use
=FunGetPic([MyScourceField])
where MyScourceField is the field with the original data.
Make sure you do not save the module with the function in with the same name as the function or you will confuse Access.

Peter
 

Users who are viewing this thread

Back
Top Bottom