473,545 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("expr10 00")<admin("cou nt_lines") Then
objfile.writeli ne orders_line
objrec1.movenex t
else
count = 0

Do While count < admin("count_li nes")

objfile.writeli ne orders_line
count = count+1
if count=admin("co unt_lines") Then
objfile.writeli ne
end if
Loop

objrec1.movenex t
end if

wend
objrec.movenext
if not objrec.eof AND objrec3("expr10 00")<admin("cou nt_lines") Then
objfile.writeli ne
else
end if
wend
=============== =============== =============== =============== =============== ==
.............. a lot of code here.

"objrec3("expr1 000")" is that counts the number of orderitems in one
order.
"admin("count_l ines")" is the number of lines that i want to write and
after this number of lines i want to write one blankline if
objrec3("expr10 00") is bigger than this.

This code works but it repeats "objrec3("expr1 000")", for example 8,
times the "objfile.writel ine 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.writel ine orders_line"?

Thanks in advance again.
Jul 19 '05 #1
2 3602
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@typh oon01>...
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,Orde rDate,TotalSum, OrderItems,Orde rStatus from orders WHERE
OrderStatus = 'ok'"

2). The query of orderitems inside while not objrec.eof.. wend.
strsql1="select OrderItemID,Ord erID,ProductID, ItemNumber,Item Price
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
8421
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' action='ins_op.php' method='post'>"; lots of form stuff
3
2155
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 figure out why any help would be much apprechiated 1. Dim line_num As Integer 2. Dim filename2 As String 3.
0
1654
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 wrong as i am not altogether sure about all of the functions but could someone help me please... where am i going wrong?...
9
9295
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 = 0; x < the_form.elements.length - 1; x++) {
3
1360
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 start new lines? Example, c:\test.txt is a file, then: "This text should be written in 1st line of c:\test.txt" "This text should be written...
0
1136
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 of output text ' / DECLARE loc_text VARCHAR2 (2000) := &line ;
2
2239
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 = source.getElementsByTagName("data_x").item(0); strXNode = xNode.text;
2
2393
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 the following manner. 3
8
3942
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
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7808
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7757
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.