Solved Export Query to txt where each row of data comes in groups? (1 Viewer)

FoolzRailer

New member
Local time
Today, 12:31
Joined
Apr 15, 2016
Messages
25
Hello

I have a pretty basic data setup, where the end query looks like the data in the table:

$NODEXYZ_FDepthOBPOSTHTYPEUTYPELTYPEENTREPRISESTATUSDIMENSIONSTATIONPERPENDCATCHMENTQA_KOEFANMOwnerTEXTXYDK_TXT
'01'6200000;45454540.101.200.70'1.1.2''KO''Well''KO''EXXX'P
1.000​
0.000.000.0000140.00100.0'''Owner 2'6200000;4545456200000;454545
02'6200000;45454540.101.200.70'1.2.4''KO''Kost''KO''EXXX'P
1.000​
0.000.000.0000140.00100.0'''Owner1'6200000;4545456200000;454545

However I have too export the above data to a specific .txt format where each row basically is transposed with the column header before the data and a space between before the next item is done. The txt file should look something like this:


$NODE '01'
XY 6200000;454545
Z_F 40.10
Depth 1.20
OB 0.70
POST '1.1.2'
HTYPE 'KO'
UTYPE 'Well'
LTYPE 'KO'
ENTREPRISE 'EXXX'
STATUS P
DIMENSION 1.000
STATION 0.00
PERPEND 0.00
CATCHMENT 0.0000
Q 140.00
A_KOEF 100.0
ANM ''
Owner 'Owner 2'
TEXTXY 6200000;454545
DK_TXT 6200000;454545

$NODE 02'
XY 6200000;454545
Z_F 40.10
Depth 1.20
OB 0.70
POST '1.2.4'
HTYPE 'KO'
UTYPE 'Kost'
LTYPE 'KO'
ENTREPRISE 'EXXX'
STATUS P
DIMENSION 1.000
STATION 0.00
PERPEND 0.00
CATCHMENT 0.0000
Q 140.00
A_KOEF 100.0
ANM ''
Owner 'Owner1'
TEXTXY 6200000;454545
DK_TXT 6200000;454545


I'm figuring I will have too use some VBA script do this, but I haven't much experience with it, and I'm therefore looking for some input or sample code suggestions on how to do this. Any help would be much appreciated! There might be 1000 rows that needs to be exported to the text file.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:31
Joined
Oct 29, 2018
Messages
21,498
I also think you'll need VBA for that. Looks like you may need a loop and an inner loop. The first loop is to go through the records, and the inner loop is for going through each column.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:31
Joined
May 7, 2009
Messages
19,246
as suggested on post#2, you can use VBA.
run fnTransposeToTxt (in Module 1).
 

Attachments

  • transpor_export.accdb
    512 KB · Views: 75

Users who are viewing this thread

Top Bottom