Printing out multiple values on the same line in a txt file

dwinn86

New member
Local time
Today, 16:54
Joined
Aug 18, 2011
Messages
7
Hi everyone,

I have been developing a form in Access 2010 that has 3 text boxes:

1. Start number for example, 1001
2. Number of pages for example, 4
3. No of copies for example, 4

When the user then clicks on to the button, a txt file is created based on these 3 numbers.

The first line reads 'Vnumber1', and goes on for however many number of pages there are.

At the moment it prints:
Vnumber1;
Vnumber2;
Vnumber3;
Vnumber4'

It then prints these 3 numbers combined but with the current page incrementing by one each time until it gets to the total number of pages.

So at the moment, it prints:
100114;
100124;
100134;
100144;

I need to print these details across the page instead of down the page, so it will look like the following:

Vnumber1'Vnumber2;Vnumber3;Vnumber4;
100114;100124;100134;100144;

here is my code so far:

Code:
Public Sub GenerateTextFiles(txtStartNo As String, txtPages As String, txtCopies As String)
DoCmd.SetWarnings False
Dim strFileName As String
Dim seq As Integer
seq = 0
Dim CurrentPage As Long
CurrentPage = 1
Dim dStartNo As String
dStartNo = txtStartNo
Dim dPages As String
dPages = txtPages
Dim dCopies As String
dCopies = txtCopies
Dim x As Long
x = 1
strFileName = "C:\File" & dPages & ".txt"
Open strFileName For Output As #1
Print #1, "%!"
Print #1, "(;) SETDBSEP"
Print #1, "(CandG" & dPages & "pp.dbm) STARTDBM"
'Printing out the Vnumber.
    Do While seq < dPages
    Print #1, "Vnumber" & CurrentPage & ";"
    seq = seq + 1
    CurrentPage = CurrentPage + 1
 
    Loop
    seq = 1
    CurrentPage = 1
 
    'Printing out the data.
    Do While CurrentPage <= dPages
    Print #1, "*" & dStartNo & CurrentPage & dPages & "*;"
    seq = seq + 1
    CurrentPage = CurrentPage + 1
    x = x + 1
    Loop
Print #1, "%%EOF"
Close #1
MsgBox ("Finished")
End Sub

How can I alter this code so that it prints both lines across the file rather than down the file.

All help will be much appreciated.

Thanks,

Dan
 

Users who are viewing this thread

Back
Top Bottom