I have a table that I need to export out to a text fiel, without column headers. I also need to have the file name include currernt date. Can anyone help me? I'm using the following code:
[b]Public Function CreateFiles()
Dim db As Database
Dim rst As Recordset
Dim m_str As String
Dim dt_str As String
Dim y_str As String
Dim d As Variant
Dim dir_str As String
Dim loc As String, fl As String, I As Integer
d = FreeFile
m_str = Format(InputBox ("Specify Month", , Month(Date)), "00")
If m_str = "" Then
Exit Function
End If
dt_str = Format(InputBox ("Specify Day", , Day(Date)), "00")
If dt_str = "" Then
Exit Function
End If
y_str = InputBox("Speci fy Year", , Year(Date))
If y_str = "" Then
Exit Function
End If
Set db = CurrentDb
For I = Len(db.Name) To 1 Step -1
If Mid(db.Name, I, 1) = "\" Then
Exit For
End If
Next I
loc = Left(db.Name, I) & "Batches\Pmts_b y_Checks_"
Set rst = db.OpenRecordse t("PMTS_BY_Chec ks", dbOpenSnapshot)
Open loc & "PMTS_BY_Checks _" & m_str & dt_str & Right(y_str, 2) & ".txt" For Output As d
Do
Print #d, [AccountNumber] & "," & !Amount & "," & !PMTType & "," & ![PaymentDate] & "," & ![Description] & "," & "," & ![InvoiceNum] & "," & ![Check #]
.MoveNext
Loop While Not .EOF
Close d
End Function
I get the following error message:
Comile Error
External name not defined
It looks like error near Print #D, [AccountNumber]
Thank you in advance.
2 3369 pks00 280
Recognized Expert Contributor
How about something simple like this
DoCmd.TransferT ext acExportDelim, , "PMTS_BY_Checks ", "c:\tsdn\Pmts_b y_Checks_" & Format(Now(), "yyyymmdd") & ".txt", False
this exports to a folder called c:\tsdn
datetimestamp is YYYYMMDD
eg
filename is Pmts_by_checks_ 20070411
Thank you. It worked but the only thing I do not want is quotes around each text field.
How about something simple like this
DoCmd.TransferT ext acExportDelim, , "PMTS_BY_Checks ", "c:\tsdn\Pmts_b y_Checks_" & Format(Now(), "yyyymmdd") & ".txt", False
this exports to a folder called c:\tsdn
datetimestamp is YYYYMMDD
eg
filename is Pmts_by_checks_ 20070411
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Otis Hunter |
last post by:
I have been fighting with this for days and your expert help is
needed! Below is the code I am executing which results with "Object
doesn't support this property or method". The error is occuring on
the "With Me.OLEObject" line. I am trying to extract a Word
document(OLE object) from an Access database, for each record in the
table, and save it as a Word Document. The 4th field of each record
is a OLE object type.
I may be getting...
|
by: premmehrotra |
last post by:
I am using Microsoft Access 2000 and Oracle 9.2.0.5 on Windows 2000.
When I export a table from Access to Oracle using ODBC
I get error:
ORA 972 identifier too long
I think the error is because one or more columns in Access table
are longer than 30 characters. My question is how one can overcome this
problem.
I also see several column names which have /, ? or spaces in name
|
by: premmehrotra |
last post by:
I am using Access 2000 and Oracle 9.2.0.x on a Windows 2000. I have
setup Oracle 9.2 ODBC Driver (I have not yet figured how to set
Microsoft's Oracle ODBC driver).
I am exporting a table from Access to Oracle and I get following error:
ODBC Call Failed:
ORA-12571: TNS Packet Failure Error
I see table and its indexes created in Oracle. However, there are no
|
by: Korvath |
last post by:
I am trying to export an Access table with ~118,000 records to Paradox 4.5. I am receiving an error message Reserved Error (-5016). This error has no description, so I am at a loss to fix this problem. This is an issue we have never had before. Has anyone seen this before and is there a fix or workaround?
Thanks.
|
by: HenHouse |
last post by:
Hi folks;
Hey wow! First post! Hope it bears fruit... Anyway, I've been teaching myself Access since March by writing an event/contact management database for the firm I work for. It's reasonably straightforward, it just records details on our clients among other thihgs. The old Lotus DB it (supposedly!) supercedes had a handy feature that I've so far had no luck in replicating in Access. It worked as follows:
1. The user browsed to a...
| |
by: aloke.sarnobat |
last post by:
Hello,
I am new to this forum, so your help would be most appreciated.
I am trying to create a javascript where, on clicking a button, I will
be able to download the latest log file. But the log filename changes
everyday as it takes the current date as part of the filename. eg.
EMEA_20070806 i.e. EMEA_yyyymmdd
Also, the previous day's log file is stored in the same directory.
|
by: JFKJr |
last post by:
Hi! I have exported an access table data into an excel file using the following code. However, the code exported all the data to the excel sheet starting from 'A' cell (first column). But I want to export all the data into the excel starting from cell B (second column) and include the heading "Extract Policy" followed by checkboxes in 'A' cell.
Can anyone suggest me how to do this? Thanks a million in advance.
Function ExportTableToExcel()...
|
by: sarah2855 |
last post by:
Hello All,
I'm looking for the vb code that export an access table to specific worksheet in Excel. I tried to search see if this question was answered before here, but didn't find anything that really relates to this question.
I will appreciate your help,
thanks in advance.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |