Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename files in TransferDatabase

Status
Not open for further replies.

AndieV

Technical User
Sep 2, 2001
10
0
0
CA
I have the following code set up in my program. I would like to know if there is a way for me to change the name of the dbaseIII file without having to go into the code.

ie. I would like to export Newtable to Monday.dbf on Monday, Tuesday.dbf on Tuesday etc.

Is there a way to do this easily? Thanks in advance for any help.


DoCmd.TransferDatabase acExport, "dBase III", "c:\filefolder", acTable, "Newtable", "Monday.dbf"

Andie
 
use the Date WeekDay functions

First establish a variable to capture the Day of the Week in Text format

Dim strDayOfWeek As String

Then use a Select Case Statement to Determine the Day of the Week based on the Date

Select Case WeekDay(Date)
Case vbSunday
strDayOfWeek = "Sunday"
Case vbMonday
strDayOfWeek = "Monday"
Case vbTuesday
strDayOfWeek = "Tuesday"
Case vbWednesday
strDayOfWeek = "Wednesday"
Case vbThursday
strDayOfWeek = "Thursday"
Case vbFriday
strDayOfWeek = "Friday"
Case vbSaturday
strDayOfWeek = "Saturday"
End Select

Use this Code which replaces "Monday.dbf" with what you want

DoCmd.TransferDatabase acExport, "dBase III", "c:\filefolder", acTable, "Newtable", & strDayOfWeek & ".dbf"

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top