Access VBA Create new table and use data from a query


  • Hi,

    I'm just a beginner using VBA with access.

    I want to create a new table using VBA if this is done save it as a TXT file ASCII and then remove the created table

    In the query i have the data but the data is vertikal ( ITEM_NUMBER, ITEM_LOCATION, ITEM_QTY, Field 4, etc etc )

    Now i want to create a table like:

    "[JOB_START]" ( Only in the first record )



    Data From query ( ITEM_NUMBER )


    Data From query ( ITEM_LOCATION )


    Data From query ( ITEM_QTY )

    etc etc.....

    "[JOB_END]" ( Only in the last Record )

    Until the last Record has been filled... Then Save as TEST.TXT ( ASCII ) Then delete the current Table.

    Pleasy is here someone who could help me with this ??

    Kind Regards,

    Richard Keizer ( Holland )

    Montag, 19. August 2013 20:19


  • Hi Richard,

    There is a better way, using 1 line of code. Create a query that selects the data. Then use DoCmd.TransferText to export that data to a text file.

    No need to create a table.

    -Tom. Microsoft Access MVP

    Dienstag, 20. August 2013 03:30