Solved

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

Posted on 2014-11-14
4
130 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
ID: 40443009
does it work with bang syntax?

Try

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

Author Comment

by:SteveL13
ID: 40443255
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
ID: 40443269
& Format(Me.txtDateofVisit, "yyyymmdd") &

or use dashes

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

Author Closing Comment

by:SteveL13
ID: 40443276
Thanks to both of you.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

910 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

24 Experts available now in Live!

Get 1:1 Help Now