Solved

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

Posted on 2014-04-23
2
408 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 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

776 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