Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2014-11-14
4
133 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 36

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

828 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