We help IT Professionals succeed at work.

"Access 2010", Referance a Text Field within another Text Field in a report.

kixelsyD asked
Last Modified: 2014-05-14
I am trying to create an Access 2010 DB that will create a report for requesting travel. The DB is all set up with Tables, Queries, forms and a Single Report.
In the report, I have a field that gives the explanation on when and where the travel will be.
Such as:
"I will be traveling on [date] and going to [Location] and returning on [Date]."
What I would like to do is to have a template text and have the dates and location embedded into the text. The idea is to have a database that will record the requests and have a standardized document to be printed. The static text is a "Label" and not a text field.

Any suggestions would be great.

Thank you for your time,
Watch Question

Distinguished Expert 2017

Use the Replace() function to replace the token with the actual date.

replace(Me.yourcontrol.Caption, "[Date]", Me.datefield)

If that gives you an error (you may not be able to replace the caption on the fly), then change it to a text box and keep the string in your code as a variable or keep it in a table and get it when you need it.  Using a table gives you more flexibility and will allow a user to change it rather than the programmer having to change is.
Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Another options would be to create a function that returns your not-so static text, something like:

Public Function fnTravelRequest(dtDepart as variant, _
         strLocation as variant, dtReturn as variant) as string

fnTravelRequest = "I will be traveling on " _
     & iif(IsNull(dtDepart), "TBD", Format(dtDepart, "dd mmm, yy")) _
     & " and going to " & NZ([Location], "TBD") _
     & " and returning on " _
     & iif(IsNull(dtReturn), "TBD", Format(dtReturn, "dd mmm, yy"))

End Function

Open in new window

MIS Liason
Most Valuable Expert 2012
This one is on us!
(Get your first solution completely free - no credit card required)


Thanks Jeff,

After looking at the DB, I went with just creating a simple query.

Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

ok, great, ...glad I could help

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.