Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Eval() or other functions to reference string literals

Status
Not open for further replies.

shauntwo

Technical User
Jul 9, 2002
64
US
To sum up the scenario: I have a loop that moves through a recordset of field values, of text data type, that I'm attempting to assign to a field in another table bound to my form. For example, consider the following column:

SOURCE_VALUE
-----------
Now
str_user_ID
-----------

Now, in my module, I have the following line:

Forms(str_form)(str_SQL) = Eval(![SOURCE_VALUE])

To clarify, the str_SQL is simply a concatentation of the table and field name bound to the form - this appears to check out fine. Obviously, my problem is that Access views the ![SOURCE_VALUE] as a string, or in the first field instance, "Now". However, Eval() gets rid of that problem. However, the next item, str_user_ID, is actually a public variable reference, but Eval() bombs because it appears to simply be a string.

The natural question is, how can you extract the "underlying" value of a string, whether it represents a function or variable? I'm trying to get lean, dynamic VBA code for my database, and this is a stumbling block.

Thanks to all.
 
I've re-read your question a few times, and can't make out what you are trying to do overal.. which may be part of the problem. I sometimes get so carried away in trying to find the solution for something, I forget what the original problem was!

From what I can see you want to stamp ONE field with a user name, date, form and table?

You have the four variables populated with data yes?

strForm, strTable, str_User_ID, and obviously the Now() function..

So why not just chuck these four concatenated into another variable, and write that value to a field using recordsets?

Apologies if I've misread your situation?



------------------------
Hit any User to continue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top