Adding header and footer in Table

Drunkenneo

Registered User.
Local time
Today, 10:47
Joined
Jun 4, 2013
Messages
192
I have a single column table which is created by set of queries, the data type is of memo, the single column table is a merge of a table with multiple columns by adding a space between the columns.

This table is then exported to the txt file, i want to add header and footer which appears exactly on the position after exporting as of now the header and footer is occuring in between the table data.

Please help.
 
Could you post more details of your source table and queries? I can't picture them clearly from your description.

You can't have headers and footers as such in a table, but you might be able to get the result you want by using a Union query.
 
Seems to me that it would be easier all around to just use TransferText to export a query or table rather than going through the effort to stuff it into a memo field first and then writing code to do the export. TransferText lets you create different flat file formats and gives you an interface you can use to create fixed width columns, if that is what your destination application requires. Press the advanced button when you are in the export dialog. Once you set it up, don't forget to name it and save it. Your code can then refer to the saved export spec to automate the export.

The Access way - 1 line of code.
Your suggested way - dozens or hundreds of lines of code.
 
I am using transfer text only

The reason of heaader and footer coming in middle is , before inserting in the table i am inserting header and footer and then rest of the Data.

Due to which the header and footer goes in between, and when tranfer text command is clicked it transfers only as a stored table.

The only chump here is i am inserting header and footer as normal table record, which the table fails to order. I am thinking to fix the order of header to top while in insert query and the footer on bottom which wil solve my problem, how to do it?
 
You can force this but it's not pretty.

Select field1, field2 from tblHeader
UNION ALL
Select field1, field2 from yourDataTable
UNION ALL
Select field1, field2 from tblFooter;

tblHeader and tblFooter contain just 1 row each - your header and footer text

Pat Harman's solution is more elegant. You could adopt it and put an extra column in to facilitate the OrderBy step.
 

Users who are viewing this thread

Back
Top Bottom