|
-
Aug 20th, 2008, 07:56 AM
#1
Thread Starter
New Member
increment records and loop between records based on condition
dear all,
I want to increment each record in my table 50 times.
for example if i have 3 records: 50,100,200.
I want to out put these record in a text file.
My first row in file will be 50(50+0), second will be 51(50+1), third wiil be 52 and so on till 99.
Now i want to do a check before incrementing the second record in my table.
only if next record, in my case = 100 minus first record 50 is 50 then go to next record and do the same incrementing.
if the minus operation is more than 50 than the file should be ended. and a new text file should be created.
i have done the incrementing part but i cant make the minus part work..
as i cannot get the second record in a variable
my code is below;
datum = Text1.Value
item_no = Combo1.Value
tmp_val = ""
serial = ""
If Not rs.EOF Then
rs.MoveLast
rcount = rs.RecordCount
rs.MoveFirst
Close
Open "c:\test.txt" For Output As #1
While Not rs.EOF
For i = 0 To rs.Fields.Count - 1
serial = rs.Fields(rs.Fields(i).Name) + 0
tmp_val = serial & "|" & datum & "|" & item_no
Print #1, tmp_val
tmp_val = serial + 1
tmp_val = tmp_val & "|" & datum & "|" & item_no
Print #1, tmp_val
tmp_val = serial + 2
tmp_val = tmp_val & "|" & datum & "|" & item_no
Print #1, tmp_val
tmp_val = serial + 3
tmp_val = tmp_val & "|" & datum & "|" & item_no
Print #1, tmp_val
Next i
tmp_val = tmp_val & vbCrLf
tmp_val = ""
tmp_val = serial + 50
rs.MoveNext
If tmp_val = serial Then ......
DoEvents
Wend
Print #1, tmp_val
MsgBox "Process Completed"
Close #1
End If
End Sub
can some one help me please?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|