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
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
- [Temp] > Path of the TEMP folder
- [RecordNumber] > N-th record in the current run of a process