PC Review


Reply
Thread Tools Rate Thread

Appending Date to File Name Syntax Question

 
 
=?Utf-8?B?SmltIE9yeQ==?=
Guest
Posts: n/a
 
      3rd Nov 2007
Using WinXP and Access2K2

In the following 'on click' event in visual basic a text file is produced
and sent to a file folder. The file name is always the same. I'd like to be
able to append the current date to the file name ending up with as an
example; "ADIF_11032007.adi", or whatever date it happens to be at the time
of the report. My code so far:

Dim stDocName As String
Dim MyDate As String

MyDate = Date


'Selects which report to use based on queries for each report
If optQSL = 1 Then
stDocName = "rptADIF_eQSL"
ElseIf optQSL = 2 Then
stDocName = "rptADIF_LoTW"
End If

DoCmd.OutputTo acOutputReport, stDocName,_ acFormatTXT,
"C:\Ham\ADIF_Files\ADIF.adi"

Exit_Adif_Click:
Exit Sub

Err_Adif_Click:
MsgBox Err.Description
Resume Exit_Adif_Click

End Sub
------------------------------------------------------------------------------------------------

In visual basic help:

Date Function Example
This example uses the Date function to return the current system date.

Dim MyDate
MyDate = Date ' MyDate contains the current system date.
-----------------------------------------------------------------------
Is it possible to do this?
--
Jim Ory
 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      3rd Nov 2007
On Sat, 3 Nov 2007 10:44:01 -0700, Jim Ory
<jim[at]oryfamilyhistory[dot][comma]> wrote:

Sure:
DoCmd.OutputTo acOutputReport, stDocName,_ acFormatTXT,
"C:\Ham\ADIF_Files\ADIF" & Format$(Date,"mmddyyyy") & ".adi"

-Tom.



>Using WinXP and Access2K2
>
>In the following 'on click' event in visual basic a text file is produced
>and sent to a file folder. The file name is always the same. I'd like to be
>able to append the current date to the file name ending up with as an
>example; "ADIF_11032007.adi", or whatever date it happens to be at the time
>of the report. My code so far:
>
> Dim stDocName As String
> Dim MyDate As String
>
> MyDate = Date
>
>
>'Selects which report to use based on queries for each report
> If optQSL = 1 Then
> stDocName = "rptADIF_eQSL"
> ElseIf optQSL = 2 Then
> stDocName = "rptADIF_LoTW"
> End If
>
> DoCmd.OutputTo acOutputReport, stDocName,_ acFormatTXT,
>"C:\Ham\ADIF_Files\ADIF.adi"
>
>Exit_Adif_Click:
> Exit Sub
>
>Err_Adif_Click:
> MsgBox Err.Description
> Resume Exit_Adif_Click
>
>End Sub
>------------------------------------------------------------------------------------------------
>
>In visual basic help:
>
>Date Function Example
>This example uses the Date function to return the current system date.
>
>Dim MyDate
>MyDate = Date ' MyDate contains the current system date.
>-----------------------------------------------------------------------
>Is it possible to do this?

 
Reply With Quote
 
=?Utf-8?B?SmltIE9yeQ==?=
Guest
Posts: n/a
 
      3rd Nov 2007
Tom,
Thank you. Works just the way I thought I'd like. This takes so much work
out of the process I had been using.
--
Jim Ory


"Tom van Stiphout" wrote:

> On Sat, 3 Nov 2007 10:44:01 -0700, Jim Ory
> <jim[at]oryfamilyhistory[dot][comma]> wrote:
>
> Sure:
> DoCmd.OutputTo acOutputReport, stDocName,_ acFormatTXT,
> "C:\Ham\ADIF_Files\ADIF" & Format$(Date,"mmddyyyy") & ".adi"
>
> -Tom.
>
>
>
> >Using WinXP and Access2K2
> >
> >In the following 'on click' event in visual basic a text file is produced
> >and sent to a file folder. The file name is always the same. I'd like to be
> >able to append the current date to the file name ending up with as an
> >example; "ADIF_11032007.adi", or whatever date it happens to be at the time
> >of the report. My code so far:
> >
> > Dim stDocName As String
> > Dim MyDate As String
> >
> > MyDate = Date
> >
> >
> >'Selects which report to use based on queries for each report
> > If optQSL = 1 Then
> > stDocName = "rptADIF_eQSL"
> > ElseIf optQSL = 2 Then
> > stDocName = "rptADIF_LoTW"
> > End If
> >
> > DoCmd.OutputTo acOutputReport, stDocName,_ acFormatTXT,
> >"C:\Ham\ADIF_Files\ADIF.adi"
> >
> >Exit_Adif_Click:
> > Exit Sub
> >
> >Err_Adif_Click:
> > MsgBox Err.Description
> > Resume Exit_Adif_Click
> >
> >End Sub
> >------------------------------------------------------------------------------------------------
> >
> >In visual basic help:
> >
> >Date Function Example
> >This example uses the Date function to return the current system date.
> >
> >Dim MyDate
> >MyDate = Date ' MyDate contains the current system date.
> >-----------------------------------------------------------------------
> >Is it possible to do this?

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date conversion when appending an external file Will Sellers Microsoft Access External Data 1 1st Nov 2006 01:07 PM
APPENDING DATE AND TIME TO FILE =?Utf-8?B?anJwNDQ0?= Microsoft Access External Data 2 14th Mar 2006 05:46 PM
File Date appending =?Utf-8?B?SnVzdGlu?= Microsoft Access 2 31st Oct 2005 11:46 PM
RE: File Date appending =?Utf-8?B?T2Zlcg==?= Microsoft Access 0 31st Oct 2005 05:07 PM
Upload form - appending date/time to file name =?Utf-8?B?c3VyZnd0aHNoYXJrcw==?= Microsoft Frontpage 3 27th Feb 2004 01:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:59 PM.