473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Loop Inside loop for writing text lines

Hi Guys!!!

Thanks in advance for any kind of help about this problem.

The problem:

Acces Database
One Table 'Orders' and second 'OrderItems'

I want to export in txt file using FSO and write all orderitems
ordered by orders.
And i want to write a blankline if the orderitems is more than 5, for
example, in one order.

I try to do using this code:

..........a lot of code here

=================================================
if objrec3("expr1000")<admin("count_lines") Then
objfile.writeline orders_line
objrec1.movenext
else
count = 0

Do While count < admin("count_lines")

objfile.writeline orders_line
count = count+1
if count=admin("count_lines") Then
objfile.writeline
end if
Loop

objrec1.movenext
end if

wend
objrec.movenext
if not objrec.eof AND objrec3("expr1000")<admin("count_lines") Then
objfile.writeline
else
end if
wend
================================================== ===========================
.............. a lot of code here.

"objrec3("expr1000")" is that counts the number of orderitems in one
order.
"admin("count_lines")" is the number of lines that i want to write and
after this number of lines i want to write one blankline if
objrec3("expr1000") is bigger than this.

This code works but it repeats "objrec3("expr1000")", for example 8,
times the "objfile.writeline orders_line", for example 8 times.
How can stop the loop and tell the code to stop repeat it, but
continue with the next "objfile.writeline orders_line"?

Thanks in advance again.
Jul 19 '05 #1
2 3596
Why not query the database to have one record per order with the count of
Order Items?
Show me the field names and I'll give you some sample code to do what you
want.

-dlbjr

Discerning resolutions for the alms
Jul 19 '05 #2
"dlbjr" <do******@do.u> wrote in message news:<%qbsb.181$Qy4.14180@typhoon01>...
Why not query the database to have one record per order with the count of
Order Items?
Show me the field names and I'll give you some sample code to do what you
want.

-dlbjr

Discerning resolutions for the alms


Thank you for your reply.

1). The query of orders.
strsql="select OrderID,
CustomerID,OrderDate,TotalSum,OrderItems,OrderStat us from orders WHERE
OrderStatus = 'ok'"

2). The query of orderitems inside while not objrec.eof.. wend.
strsql1="select OrderItemID,OrderID,ProductID,ItemNumber,ItemPrice
from orderitems where orderid = " & orderid
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: rjames.clarke | last post by:
I have the following. $result=mysql_query($sql); $nrows=mysql_num_rows($result); for ($i=0;$i<$nrows;$i++) { $row_array=mysql_fetch_row($result); echo "<form name='testform'...
3
by: bbepristis | last post by:
Hey all I have this code that reads from one text file writes to another unless im on a certian line then it writes the new data however it only seems to do about 40 lines then quits and I cant...
0
by: DaBizNOS | last post by:
Basically i have been programming for a year, and have just started using visual basic. I have programmed a small game and am trying to create a high score board. i might have got this completely...
9
by: wreed | last post by:
I have a for loop seen below.... var the_form = document.getElementById(formName); for(var i=0; i<the_form.length; i++) { var temp = the_form.elements.type; if (temp == "radio") { for (x =...
3
by: =?Utf-8?B?am9obmFicmFoYW0xMDE=?= | last post by:
hello all, I've already posted a thread with the same problem but couldn't satisfactory answer. Let's come to the point. I can write some text to a text file with WriteAllText method. How can I...
0
by: buzzw | last post by:
Hi I have a wraptext procedure which accepts input text and fits it within given output length . Following is my test script Accept line Prompt 'enter text : ' Accept len prompt 'enter length...
2
by: innova | last post by:
Hi, I am using a for loop inside xsl as follows, <SCRIPT LANGUAGE="JavaScript"> function xmlParse() { source = document.XMLDocument; xNode =...
2
by: virtualweb | last post by:
Hello: I got stuck again.... In my Hotel Reservation script all reservations are saved in a flat file which name is the room number. (example: Data/room1-101.dat). Reservations are saved in...
8
by: santhanalakshmi | last post by:
Hi, Please see my code: !c:/perl/bin/perl use CGI qw(:all); $empid=param('empid'); print "Content-type: text/html\n\n"; print "<body bgcolor=\"#ffcccc\">";
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.