Three tables to Text

LennyNero

Registered User.
Local time
Today, 04:57
Joined
Jul 31, 2008
Messages
18
Hi,

I have 3 tables i need to export to text, i already made the code to write one of the to text the others think its the same, the problem is that i need to put them like this:

header table to text in first line of text file
detail table with 999 rows just after header
footer table 1 line at end of text

Hope i can get some ideas im stuck

Thanks in advance
Luis
 
Hi,

I'm developing a small access db to comply with some specs that were asked.
Its a small hospital we need to send to one of the ensurance company's a report of the things we billed.
Ill be attaching the table of our billing software to make a query for those records.
Now comes the problem, i need to report it as text, each file sent has all the invoices in one month, normaly the previous.
The text file must have:
A header with a unique number and some other fields easy to add
The details must have all the lines in the previous month plus a calculated field for quantity*mediccare
The footer contains the total number of details and the sum of all values.

I created 2 tables, 1 for header and footer and one for the details. then a temp table that imports the values and appends to the details. (here i cant figure out how to link the details i imported to a header number)
I tested the export to text with just the values of the header and it went fine. (i have the code made, although i cant name the file with values from database dont know how).
:confused:
I know my questions are a little vague but i can specify, im just looking for ideas how to make this , im really stuck, appreciate all help i can get.

Thanks
Luis

Now i cant figure out how to join all data and put it all in the same file

Working on it now...
 
The small code i adapted for text export 1 table

Public Function CreateTextFile()
Dim strTIPOLINHAH As String * 2 'specifies width of 2 characters
Dim strFILERH1 As String * 1
Dim strCODENTIDA As String * 9
Dim strCODTIPENT As String * 8
Dim strNUMFACT As String * 8
Dim strANOMESFACT As String * 6
Dim strDATAENVIO As String * 8
Dim strCODREJEICAO As String * 2
Dim strFILERH2 As String * 81
Dim mydb As DAO.Database, myset As DAO.Recordset
Dim intFile As Integer
Set mydb = CurrentDb()
Set myset = mydb.OpenRecordset("header", dbOpenTable)
intFile = FreeFile
Open "C:\TESTE7.txt" For Output As intFile
myset.MoveFirst
Do Until myset.EOF
LSet strTIPOLINHAH = myset![TIPOLINHAH] 'Field name in brackets
RSet strFILERH1 = Format(myset![FILERH1], "0")
RSet strCODENTIDA = Format(myset![CODENTIDA], "000000000")
RSet strCODTIPENT = Format(myset![CODTIPENT], "00000000")
RSet strNUMFACT = Format(myset![NUMFACT], "00000000")
RSet strANOMESFACT = Format(myset![ANOMESFACT], "yyyymm")
RSet strDATAENVIO = Format(myset![DATAENVIO], "yyyymmdd")
RSet strCODREJEICAO = Format(myset![CODREJEICAO], "00")
RSet strFILERH2 = myset![FILERH2]
Print #intFile, strTIPOLINHAH & strFILERH1 & strCODENTIDA & strCODTIPENT & strNUMFACT & strANOMESFACT & strDATAENVIO & strCODREJEICAO & strFILERH2
myset.MoveNext
Loop
Close intFile
myset.Close
mydb.Close
MsgBox "O ficheiro foi criado!"
End Function

It writes the header fine, how do i add the details to this?
 

Users who are viewing this thread

Back
Top Bottom