Using Expressions
Expressions give a powerful way to let a value be determined dynamically /
at runtime. An example of this would be automatic naming and storing of
documents. Expressions allow you to pick up values from:
- Fields in the data source;
- Functions in Access
- Access Mail Merge defined substitutions
- Strings
- Mail Merge specific names
Examples
- SaveAs.Folder = "[My Documents]\[Template]" 'puts document in a subfolder
of My Documents with the name of the template, e.g. My Documents\Contract
- SaveAs.File =
"[Template]_[Field:CustomerName]_[Function:Format(Now(),'mmddyy')]" 'names the
document after template, CustomerName and date creation,
e.g. Contract_Jones_120507
- Use to create an Email
with File Attachment from Hyperlink
What happens behind the scenes is that a property such as SaveAs.Folder is
evaluated so that
- [Field:...] is replaced with the value of that field in the current
record
- [Function:Date()] are evaluated with what is currently returned from
Access
- Access Mail Merge defined substitutions are executed
- [Template] > name of the template
- [processname] > name of process being run
- [My Documents] > Path of the 'My Documents' folder
- [Documents] > Path to s documents folder as set in Process Options. This is especially
useful if documents need to be shared by multiple users.
- [Temp] > Path of the TEMP folder
- [RecordNumber] > N-th record in the current run of a process
- [documentfullname] > picks up the filename of a document that was
saved using 'Save As'. If there are more then 1 SaveAs or Convert activities in
the process, you can indicate which one to use by adding the number, e.g.
[documentfullname:1]
- [documentshortname] > same as [documentfullname] , but now without
folder and extension
- [DocumentHyperlink] > shorthand for
[documentshortname]#[documentfullname]#, easy to use to fill hyperlink
fields