Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-11-14
4
Medium Priority
?
140 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
[X]
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
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 1000 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 39

Assisted Solution

by:PatHartman
PatHartman earned 1000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

670 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