Solved

Trying to export fiel to desktop with date field included in the name of the file

Posted on 2014-11-14
4
128 Views
Last Modified: 2014-11-14
I have this code which exports a file to the desktop just fine...

strXLFile = strDesktopPath & "\Checklist - " & Forms!frmIHMGnotes.Text328 & " To Office " & ".xml"

But when I try to add a field from the open form (txtDateOfVisit), I get an error using...

strXLFile = strDesktopPath & "\Checklist - " & Forms!frmIHMGnotes.Text328 & " To Office " & Me.txtDateofVisit & ".xml"

I'm pretty sure it's a syntax thing.  Can someone help?

--Steve
0
Comment
Question by:SteveL13
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 250 total points
Comment Utility
does it work with bang syntax?

Try

strXLFile = strDesktopPath & "\Checklist - " & Forms!frmIHMGnotes.Text328 & " To Office " & Me!txtDateofVisit & ".xml"
0
 

Author Comment

by:SteveL13
Comment Utility
That did not work but I think I know why but don't know how to fix it.   txtDateofVisit  is a date field like 11/14/2014.  But the exported file name can't have "/" marks in it.  Right?

So then how can I convert 11/14/2014 to read 11142014 (without the slash marks)?

--Steve
0
 
LVL 34

Assisted Solution

by:PatHartman
PatHartman earned 250 total points
Comment Utility
& Format(Me.txtDateofVisit, "yyyymmdd") &

or use dashes

& Format(Me.txtDateofVisit, "mm-dd-yyyy") &
0
 

Author Closing Comment

by:SteveL13
Comment Utility
Thanks to both of you.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now