Link to home
Start Free TrialLog in
Avatar of firstbankak
firstbankakFlag for United States of America

asked on

Can you save CF code in an Access database?

I am working on a workaround but ideally I would like to do this:

I have a field in an Access database (have tried text and memo fields) and am trying to store CF variables such as

...mailto:#PE.Active#?cc=#PE.Backup#&Subject=Webmaster...

But the email opens with the variables literally as #PE.Active# instead of their values...



Avatar of bwasyliuk
bwasyliuk

I store variables, etc in my database (always need to be careful that they exist when doing the following, but it works):

I might have a value like this in a database field: "this is a string with a variable called 'test', its value is"&variable.test

This is of course a very contrived example, but you can take this value (lets say it is in Col1) and evaluate it:

<cfoutput>#evaluate(myquery.Col1)#</cfoutput>

Let me know if you need me to explain further.
Avatar of firstbankak

ASKER

Hmmmm...here's literally what I am trying to accomplish:

<cfoutput query='test'>
<a href='#mhLink#'>#mhName#</a>
</cfoutput>


where mhLink = "mailto:#PE.Active#?cc=#PE.Backup#&Subject=Webmaster"
So, you could do:

<cfoutput query='test'>
<a href='#evaluate(mhLink)#'>#mhName#</a>
</cfoutput>

Of course, the #PE.Active# and #PE.Backup# variables have to exist prior to this evaluate step.
You know, that didn't work, but thanks for helping out I'm just going to go another way with this...
Out of curiosity - which part didnt work?
You need to use quotes in the DB, so it should look like this:

'mailto:' & #PE.Active# & '?cc=' & #PE.Backup# & '&Subject=Webmaster'

Then you could use:

evaluate(yourQuery.yourColumn)
Avatar of dgrafx
why not use a "flag"
real basic ex:
at time of insert or update db you put in the flag

for ex, you insert this text:
"mailto:^PEActive^?cc=^PEBackup^&Subject=Webmaster"

Then when you pull it out:
#replace(PE.yourdbfield,"^PEActive^",PE.Active,"all")#

I'm assuming your query name is "PE"

et cetera
How did this work for you?  If it didn't work with the hash marks from my previous example, try removing them - - but this should work.
Believe my code & usachrisk1983's code are virtually the same - and would both solve the question.
I agree with bwasyliuk, and if the poster had any problems with them, I'm sure we'd both be happy to continue to try and debug the problems.
Hello guys
I do believe mine is the best solution.
Real simple and straight forward.
Please close this question.  The individual who initiated the question with me is no longer employed here.

Thank you!
ASKER CERTIFIED SOLUTION
Avatar of dgrafx
dgrafx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial