Q: evaluate string with recordset object

M

Mark

Hi all,
I hope this makes sense. Showing what I'm trying to do is easier than trying
to explain it, but that's a bit harder to do in this case...

I am trying to build a database that compares data on a user selected
spreadsheet vs data on our SOR database using Access to do the comparison.
I'm trying to do ths dynamically so that the user only has to update the
spreadsheet data to refer to the table/fields for the compare.

I have a recordset object rs and what I want to do is have access evaluate
the string and return the result.

Easy enough to do when I only want to return one field. For example, if I
wanted to pass the contents of the field CUSTNAME to a string, I'd just do
this:
strRetString = rs(strVariableName)
where strVariableName = "CUSTNAME". strVariableName would just read that
string off the cell in Excel.

The problem is if I want to return the results of something like
rs("FIRSTNAME") & " " & rs("LASTNAME")
I would like the cell to have the string I want to evaluate, namely:
rs("FIRSTNAME") & " " & rs("LASTNAME")
then have access return that evaluated string: "John Doe"

Basically, I want to have a function that mimics the "?" operation in the
immediate window.
?rs("FIRSTNAME") & " " & rs("LASTNAME")
will return "John Doe" in the immediate window, but I haven't found any way
to return "John Doe" using variations of Eval(rs("FIRSTNAME") & " " &
rs("LASTNAME"))

Any suggestions?
Thanks,
-Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top