Link to home
Start Free TrialLog in
Avatar of wilpitz
wilpitz

asked on

Export text file with multiple lines of hard coded text, then results of query, then text

I need to built a text file that combines lines of static text then results of a query, then one last row of static text at the bottom. Below is an example of the rough outline of what the template would be. I am guessing a module would be the best way to do this but I am unsure of how to do this.

Line 1: Example Text
Line 2: Example Text
Line 3: Example Text

RESULTS FROM qry_Export

Footer: Example Text
ASKER CERTIFIED SOLUTION
Avatar of omgang
omgang
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To add static text before after


Print #1, "Line 1: Example Text"
Print #1, "Line 2: Example Text"
Print #1, "Line 3: Example Text"

    rs.MoveFirst
    Do Until rs.EOF
        'Debug.Print rs!Category
        Print #1, rs!CategoryID & vbTab & rs!ManufacturerID & vbTab & rs!Category
        rs.MoveNext
    Loop

Print #1, "Footer: Example Text"
Avatar of wilpitz
wilpitz

ASKER

Worked!!! Changed the select to the query I am using and changed the field and the code worked great!!!
Excellent.  I've used the same concept to construct html web pages, etc.
OM Gang