Solved

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

Posted on 2014-04-23
2
413 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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