ADezii - Thanks for the code. Do I just copy this into a module? Just not sure how I use the code so that I can see the text file generated.
Export data to sequential file
Collapse
X
-
Just Copy and Paste it wherever you want. It can be placed in the Click() Event of a Command Button. a Function Procedure, Sub-Routine Procedure, etc. Replace the comma after Field1 if you want a different Delimiter, replace the comma after Field2 if you want an End of Record indicator. Change the Path of Sequential.txt if you like, and simply Open it to view the Output. Any other questions, feel free to ask.Originally posted by jason2412ADezii - Thanks for the code. Do I just copy this into a module? Just not sure how I use the code so that I can see the text file generated.Comment
-
Do you need a record separator of a Carriage Return specifically, or would a Carriage Return / Line Feed sequence (standard DOS/Windows line separator) do?Originally posted by jason2412Yes, I can see how I confused the matter when I included an example with commas.
For clarity:
Field 1 - Retail
Field 2 - Sat
Field 1 - Direct
Field 2 - Sun
The required output for the above example would be:
Retail#SatDire ct#Sun
So a hash is added after field 1 and a carriage return () is added after field 2. All the data would run sequentially (left to right).
The hash and carriage return symbol is needed because a script needs that format.
Hopefully that clarifies things and a solution can be provided.
Big Thanks
If so, then a standard text export would do for you.
If not, ADezii's code, with simple modifications to use the '#' & <CR> (vbCR constant in VBA) in place of the ','s would be the recommended approach.
In truth, for the former, using ADezii's code with the VbCrLf constant instead, would also work perfectly well for you.Comment
-
Pasted the code in the click event of a command button but got a file/path access error. When I go into debug it highlights the line 'Open "C:\Sequential. txt" For Output As #1'.
I created a folder in my C: called sequential...wa s that the right thing to do?
Not very good with visual basic etc so not sure why that last line of code is not working.
Ps...cheers to all for the help, appreciated!Comment
-
There may be restrictions on the System that involved writing to the Root Directory of Drive C: (C:\). You can create any Folder/Sub-Folder you like but just remember to modify your code, specifically:Originally posted by jason2412Pasted the code in the click event of a command button but got a file/path access error. When I go into debug it highlights the line 'Open "C:\Sequential. txt" For Output As #1'.
I created a folder in my C: called sequential...wa s that the right thing to do?
Not very good with visual basic etc so not sure why that last line of code is not working.
Ps...cheers to all for the help, appreciated!
Open "C:\NewFolder\S ub-Folder\Sequenti al.txt" For Output As #1Comment
Comment