Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MS Access saving a variable name within a string in a field

Posted on 2014-04-23
2
Medium Priority
?
421 Views
Last Modified: 2014-04-24
Hi

I would like to save the name of a variable within a string saved in a field.  I would then like to retrieve the string value within a procedure and use the string/variable concatenation as if written in the procedure itself.

So for example...

Value saved in field = "There are " & varNumber & " days to go"

The procedure where used has a variable varNumber which has a value (eg 3)

The field value is then retrieved (via DLookup for example) and thus the string them reads...

There are 3 days to go


Is this possible and if so what is the correct syntax?

Many thanks
0
Comment
Question by:kenabbott
2 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 2000 total points
ID: 40018123
You can accomplish this by creating a Function to return the value of the variable.  You use the function call in the field

Function GetVariable() As Integer
   
    GetVariable = varNumber

End Function

Then in your field
"There are " & GetVariable() & " days to go"

OM Gang
0
 

Author Comment

by:kenabbott
ID: 40019675
Many thanks
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question