Creating a variable within a field

G

Guest

I'm trying to print certificates, five different types depending on what the
per registered for. I have a certificate type table listing the different
basic data for each certificate and this prints easily. In addition to this,
I want to insert names and dates within this basic text.
The certificate table field has:
The applicant "& NAME &" was registered on this day "& REGISTERED_DATE &" ."

When the report runs it pulls the data from the certificate type table but
it does not treat the "NAME" and "REGISTERED_DATE" as variables for input and
just prints everything exactly as was entered. Can this be done in Access or
do I have to create multiple certificate reports.
 
M

Marshall Barton

Erik Greene said:
I'm trying to print certificates, five different types depending on what the
per registered for. I have a certificate type table listing the different
basic data for each certificate and this prints easily. In addition to this,
I want to insert names and dates within this basic text.
The certificate table field has:
The applicant "& NAME &" was registered on this day "& REGISTERED_DATE &" ."

When the report runs it pulls the data from the certificate type table but
it does not treat the "NAME" and "REGISTERED_DATE" as variables for input and
just prints everything exactly as was entered. Can this be done in Access or
do I have to create multiple certificate reports.


Evaluating expressions in a string such as this can be
handled in a couple of ways. If the Name and Date items are
in the appropriate name space, then you can use the Eval
function to evaluate the expression. For example, assume:
1. you have text boxes on the report named PersonName and
RegisterDate;
2. the certificate field is "The applicant " &
Reports!reportname.PersonName & " was registered on this
day " & Format(Reports!reportname.RegisterDate, "d mmmm
yyyy") & "."

then the certificate textbox can use the expression:
=Eval(certificate)

Alternatively, if you do not have too many of these
substitutions in the certificate text, you could use this
kind of approach. In this case the certificate field could
be "The applicant ~NAME~ was registered on this
day ~DATE~."

=Replace(Replace(certificate, "~NAME~", PersonName),
"~DATE~", Format(RegisterDate, "d mmmm yyyy"))
 

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