Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Urgent! For Next Loop For Fibonacci Numbers!!


I need a For Next loop that will print the first 10 Fibonacci numbers 1,1,2,3,5,8,13,21,34,55)




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Need Help With Fibonacci With A Loop
here is my calculatedata module, i am totaly lost on how to get the fibonacci program to work in VB.

Counter = 0
If StartNum <= 2 Then
Counter = 1
Else
Do While FinalNum >= StartNum
FibbNum = StartNum
FibbNum = StartNum + FibbNum
FinalNum = FinalNum * FibbNum - 2 + FinalNum * FibbNum - 1
Loop
End IF
MY assignment:
Your project should display a number from the Fibonacci series that corresponds with the number entered by the user. For example, if the user enters 8, the project should display 21. If the user enters 1, it should display 1.

You output should be in a sentence. An example of the sentence follows.

“The 5th Fibonacci is 5.”


aNY HELP WOULD BE GREATLY APPREACITED

Need Help With Fibonacci With A Loop
hey i need help making a fibanocci series code that has an input box asking for how many numbers you would like generate? and i need to make a loop so that i can compute it into a cell. Here's what i have so far [/CODE]

Sub Fibnumber()

Dim num As Integer
Dim Fibnumber As Integer
Dim Counter As Integer
Dim StartCell As String
Dim Endcell As String
Dim Row As Integer
Dim NumberOfFibNumbers As Integer
Dim rng As Range
Dim iNum1 As Integer, iNum2 As Integer, iNextNum As Integer
Dim i As Integer

NumberOfFibNumbers = InputBox("How many Fibonacci Numbers would you like generated from (1 to 20?)", "Welcome")
Row = 9
StartCell = "E9"
Endcell = "E29"
Set rng = Range(StartCell, Endcell)
rng(1).Value = num
rng(2).Value = Fibnumber
rng(3).Value = NumberOfFibNumbers

iNum1 = 0
iNum2 = 1
If num = 1 Then
Fibnumber = 1
Counter = 0
For i = 2 To num
iNextNum = iNum1 = iNum2 ' c = a + b
iNum1 = iNum2 ' a = b
iNum2 = iNextNum ' b = c
Next i
Fibnumber = iNextNum ' when found, return c
End If

Row = Row + 1
End Sub

Can somebody plz help and tell me what i need to add or what im doing wrong cause it wont compute the answer or put it in the right cell!

HELP! Need For Next Loop For Fibonacci!
I need a For Next loop that will print the first 10 Fibonacci numbers1,1,2,3,5,8,13,21,34,55)

kazooie21

Adding Numbers To Chr Loop (bruteforce)
yes i know i said brute force, but please understand this is not for hacking or password cracking. its to do with producing a text file with every combination of letters up to 4 characters


heres the code i have below. it will add every combination of 4 letters into list1.

i need to somehow add numbers? chr 97 To 122 are from a to z. after z i need it to go onto 0 to 9. how can i do this?


Code:
Dim i As Integer
Dim g As Integer
Dim h As Integer
Dim j As Integer

Dim password As String
Dim password2 As String
Dim password3 As String
Dim password4 As String

For i = 97 To 122
password = Chr(i)

List1.AddItem password & vbNewLine

For g = 97 To 122
password2 = password & Chr(g)
List1.AddItem password2 & vbNewLine

For h = 97 To 122
password3 = password2 & Chr(h)
List1.AddItem password3 & vbNewLine

For j = 97 To 122
password4 = password3 & Chr(j)
List1.AddItem password4 & vbNewLine

If counter >= 3000 Then
DoEvents
Form1.Caption = password4
List1.ListIndex = List1.ListCount - 1
counter = 0
Else
counter = counter + 1
End If
Next j
Next h
Next g
Next i

Fibonacci Sequence Help...
I need to make a program to display the fibonacci sequence. The numbers have to be listed in a list box, and every number has to be displayed. A user inputs a number and thats how far to go into the sequence EX: If someone inputs 4, the box should display 1,1,2,3
Right now I am trying to use an If Then statement that addsitems for every number, and it is very long, and not vereffiecent.

Is there a loop I could run?

Can I only use part of an array?

Fibonacci Series
hello ive been programming in vb for about 18 weeks now and i need alot of help on the fibonacci series. i coded it in a do while, but i cant figure it out to make it into a for..next or anything else. this is what i have coded

Code:
Private Sub cmd1_Click()
Dim x As Integer, y As Integer, temp As Integer
' first terms in the fibonacci series
x = 1
y = 1
picfib.Cls
picfib.Print "fib series first term:"
picfib.Print x;
Do While y <= 100
picfib.Print y;
temp = x + y
x = y
y = temp
Loop
End Sub
any help is much appreciated
thanks

Help On Fibonacci Program
i put in the first two numbers of the sequenec as

Num(1)=1
Num(2)=1

and i used the formula :

Num(I+2)=Num(I)+Num(I+1)

so far i have this:

Option Explicit
Dim c As Integer
Dim x As Integer
Dim I As Integer
Dim l As Integer
Dim Num(100) As Integer

Private Sub cmdOutPut_Click()
Num(1) = 1
Num(2) = 1

c = 2

x = InputBox("How long do you want your Fibonacci sequence to be?", "Fibonacci Number Sequence")

Do Until c = x
c = c + 1
Num(c + 2) = Num(c) + Num(c + 1)
Loop

For l = 1 To x
lstDisplay.AddItem Num(c)
Next l

End Sub


when I clickekd the cmdOutPut, all the answers in the listbox are 0,

please help!

Fibonacci Series In Vb
does any one have any code for solving the fibonacci series using recursion in VB.

Many thanks in Advance

Urgent Help With Random Numbers
hi everybody

this is my very first post on this forum and i am very happy i found it, i hope it will help me solve my problems with VB and general programming.

Right now i am working on a game project, the same game as the french tv game Motus: it consist of guessing a word given the first letter. Then on the next step, correctly-placed letters are colored, let's say red, and the incorrectly placed ones are colored yellow, and those that don't exist in the word are left unchanged... anyway, the problem I actually have is that my access database consists of 26 tables (table for letter A, table B.... table Z) and each of these tables have thousands of entries (around 30000 words in total !!!); and since i have to get a random word from the tables, then, first I have to get a random letter (a random number beween 65/A and 90/Z) then a random entry from the table named Chr(my random number).
And guys you know it is almost impossible to have different words and that is actually my problem. I always get the same sequence of letters (I, T, U Q, S...) and always the same words (Image, Tabac, Union, Quake, Sport...) while i am dealing with a intervals of thousands words.
I am using the classic formula Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Can anybody help me find a solution for this problem ?

(HELP URGENT)KEY NUMBERS WITHOUT A DATABASE
Dear gurus,
How is an .exe file in VB6.0 made without a database but still generates random numbers? Where is the set of numbers kept and how? This I found for WinZip v10.0 -key generation. I think, this is made in VB6.0. But, how is it possible? I tried to see if it generates any hidden files while it is being operated. But, no files are generated.
Any suggestion? All keygen exe files are like this without the set of serials in any database. Where and how do they get the keys to display? Please reply.
pkb_pkb



Edited by - pkb_pkb on 6/24/2006 10:42:10 PM

Urgent - For Loop
I am doing VBA programming with excel and have the following code:

Dim k, j As Integer

For i = 1 To 10

k = 10

j = 0
Do While j = 0
j = 10
If (j = 10) Then
Exit Do

Next

However, if I run the peogram I get an error stating
"Next used without For".But , I have used "for"

Please help!!!!

Fibonacci Program Drives Me Nuts
I don't wanna look like [I'm lazy] and just asking to do a program for me, but I have been trying to figure it out for a total of 4 hours. The exact requirements are:

Code:
2) Write a program that will calculate the Fibonaci sequence up to a given element. Write a program that will allow the user to enter the 10, and the 34 will be calculated. Remember the Fibonaci sequence is generated by giving yourself the first two values, 0 and 1, and then adding the two previous values to get the next value.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,

For example:

Fibo(3) = Fibo(1) + Fibo(2) = 0 + 1 = 1
Fibo(4) = Fibo(2) + Fibo(1) = 1 + 1 = 2
Fibo(5) = Fibo(3) + Fibo(4) = 1 + 2 = 3
Etc.

Hint: You will need to preserve the TWO previous values in variables, not just the ONE previous value like we have done with all the rest of the loops.

Just throw suggestions out there. By the way, I use vb 6.0

Need To Make A Code Using The Fibonacci Series
Fibonacci series: The Fibonacci series contains numbers where each number is the sum of the previous two numbers. It goes as follows: 0 – 1 – 1 – 2 – 3 – 5 – 8 – 13 – 21 – 34… If you look at each number, you will notice that it is the sum of the previous two numbers. Write an application that inputs a number between 0 and 100 and outputs the Fibonacci numbers up to the input limit.

please help! i need to make this program but i dont know how to write the code!

How To Perform XOR On Two Large Numbers (V Urgent)
I am trying to execute the following code.

Res = CDbl(20041117101515) Xor CDbl(1250000)

I am getting the Overflow error.

Can any body have the solution.

Printing Numbers So They Line Up URGENT!
I need to have some numbers/data printed out and they need to line up under each other. I am using a MSFlex Grid to hold the data but I can be flexable.

Basically I have this:
Testing 0 0 0 0 0
Testing 1 0 0 0 0 0

But my printing has the numbers out of alignment....

Testing 0 0 0 0 0
Testing 1 0 0 0 0 0

If I use tabs... They are off depending on how long the test words end up.

I need to have this project done by friday!!! It MUST print and look nice.

Please help!! Thanks in advance!!


------------------
Steve Stunning
Programming for 20 years now but still learning...

Problems With Decimal Numbers In VB - URGENT
Hi
My VB program is reading data from ASCII file. Decimal numbers are converted form string to decimal by CDbl() fumction, which depends of regional setings on WINNT sistem.
For example:
regional setings set to Slovenian:
CDbl("100.05") = 10005
regional setings set to English:
CDbl("100.05") = 100.05
How can I solve this problem?
How can I read value of regional setings from Registry?

.csv To .xls (Preserving Numbers As Text) BIT URGENT :)
Hi Guys,
    It's been long time I posted a problem, now I need your help again. My problem is:
I have made a .csv file programatically throught VB Script. One of it's columns have ZIP codes with leading zeros, example "01234". When I open this file in notepad it shows me the leading zero BUT when I open in Microsoft Excel, they disappear and what I see is "1234". I need to see the leading zeros in Excel too. Also I need to convert this file into Excel (but that's a second priority).
    Please help me or give me any ideas ASAP.

Thanks in advance.

*Somewhat Urgent* For Loop Question
Hey All,

I have a quick looping problem.

Is there a way to do a for loop backwards.
Here is what I have tried.


for cntr = de.recordsource.recordcount to 1
asdfsadfasfd
next

I have tried it but it doesn't seem to work.

for cntr = 1 to de.recordsource.recordcount works fine.

But I need the opposite.

Thanks to all who help.

How To Create A Function That Sums X Fibonacci Values?
I need to write a function that lets the user input three values:
1stnumber, 2ndnumber, totalnumbers
(where 1stnumber and 2ndnumber are any two consecutive numbers of the Fibonacci numbers, and totalnumbers the total amount of numbers),
then outputs the sum of these numbers.

For example: input 1, 2, 10
(this means the following sequence from the Fibonacci: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89)
and so the function would output the sum of that sequence, 232.

Easy, right?
Propably a loop is the way to do this? I'm really a beginner with VB, so all help is greatly appreciated!

URGENT PLEASE HELP. Ascii In My Apps. Chars To Numbers.
first of all im sorry its wrong category i posted in C++ but no ones answering and i kinda need this soon.

im trying to make a C++ app that makes a directory on the desktop using DOS commands. but i want it to use the ascii character 255. this character isnt supported in windows. so how can i put it in my program? i cant just hold down alt and press 255 because then it will come out as something else.

please help. i really need this soon. thx.

(urgent) Mathematical Operation On Very Large Numbers
hi all,

I want to do mathematical operations on a number which could be as large as of 80,000 digits.

Can anyone tell me the required data type to support that.
Any Idea other then that......

Urgent: Print An Array Outside Loop
hello everybody
my code is as follows
Dim strvalue As String
Dim bit_inverse_index() As String
Dim file As Integer
Dim sfile1() As String
Dim c As Integer

file = FreeFile
Open "c:it_reverse_index.txt" For Input As #file
Do While Not EOF(file)
Line Input #file, strvalue
ReDim Preserve sfile1(0 To c + 1)
sfile1(UBound(sfile1)) = strvalue
bit_inverse_index() = Split(strvalue, "
")
c = c + 1
Loop
Close #file
For i = 0 To UBound(bit_inverse_index())
MsgBox bit_inverse_index(i), vbOKOnly
Next i

i want to know whether it is possible to access the array outside the loop where i am retrieving the text file i.e Do While Not EOF(file) because when I am outputting the array outside the loop, it is giving nothing
but i need to output the array outside the do while not eof loop,plz do help
Urgent help needed
thanks

Urgent!!! Y Wont This Loop Work???
Why wont the do loop at the beggining loop the code it contains/??? i have no clue?? please help!


Private Sub Command1_Click()

Do

Dim intCount As Integer

intCount = 1

Dim X

X = Shell("rundll32.exe rnaui.dll,RnaDial " & Text1.Text, 1)


DoEvents

SendKeys "{enter}", True

DoEvents

Do While ActiveConnection = False

DoEvents

Loop

Dim iret As Long

iret = ShellExecute(Me.hwnd, vbNullString, _

Text2.Text, vbNullString, _

"c:", SW_SHOWNORMAL)

dwMilliseconds = 30000

Sleep dwMilliseconds

Call HangUp

Loop Until intCount = Text3.Text

I Need A For...Next Statement For A Square Root And Show Fibonacci Sequence
I need a For...Next statement that will show the square roots of 2 to 12 and only the even numbers.

I also need one that will show the first 10 numbers of the Fibonacci sequence.

kazooie21

Urgent! How To Insert Page Numbers To A Word Document?
Hi everyone,

I'm currently trying to create a Word document from VB 6. Does anyone know how to insert page numbers to a Word document?

Thank you very much.

ActiveReports Images And Page Numbers - Urgent Help Needed
Hi,

I'm using ActiveReports to pull up 4 records/images across and 3-4 records/images down, per page. I have bound each label to the MDB, so not much code needed there. What I do need is to display a different image for each record in an Image control. The actual image name on the drive is made up from the ProductID.
For example, an MDB field contains say 'XYZ123' only. I then need to append '.jpg' to the end of it to display the actual image. In this case, 'XYZ123.JPG'. How do I make this happen?

See http://www.qldemail.com/ee/example.jpg for what I am trying to do.

Lastly, I need to start auto Page numbering from Page 4, not Page 1. Is there a way of doing this?

Thanks.

URGENT Masked Edit Control, How Can I Justify Numbers To The Right????
Hi!, I'm from MΓ©xico and I've some troubles formating numbers with this control (masked edit control), I would like to justify numbers to the right as they should be, but I can't (they all go to the left). And I don't know how can I do it , or which controls can I use.

please help me!!

Salu2

{Loop Through Controls Of A Control Array}-URGENT
hi..

i have a winsock control array with index's say 0,1,4,6,etc...
i want to knw how to loop through all the control arrays of dat control...
pls help!

How To Search A Textbox For Numbers, And If Numbers Not Found Give Error (Solved)
Hi, how do I go about searching a textbox to see if it has numbers only, and if it has like letters and other characters that are not number give an error.

Thanks

[SOLVED]FormatCurrency Returns Numbers As Text Instead Of Formatted Numbers
This seems as a really dumb question but..... why is it that numbers resulting from a calculation work perfectly BEFORE I format them as currency and DO NOT work as numbers after I have formatted them?



Code:frmDCashFlow.Text7.Text = Val(frmDCashFlow.Text4.Text) + Val(frmDCashFlow.Text5.Text) + Val(frmDCashFlow.Text6.Text) 'This returns a value... OK

frmDCashFlow.Text7.Text = FormatCurrency(frmDCashFlow.Text7.Text, 0) ' This returns numbers as text, that can't be used to calculate once formatted....

Why and how can I avoid this? The FormatCurrency function is supposed to return a numeric expression formatted as currency value.....


Thanks for any help

_________________________________________________________________

Edited by - vbprog1144 on 10/26/2004 1:00:34 PM

Converting String Numbers Into Real Numbers
Hi,

I have a formula in VBA that searches through a table for corresponding results to the conditions I specified and sort the results into another table. My problem is that the data I use, which includes monetary values, seems to have converted them into string numbers (which include de $ sign as part of the characters and not only into a simple visual effect). It's a problem when I want to do mathematic operations with those monetary values. Is there a way to convert them into real numbers in my VBA code just before doing my maths with them? I tried to pre-format the cells before their extraction but it seems it isnt enough to really convert them.

Thx!

Werner

Splitting Large Numbers Into Smaller Numbers
i want to divide a decimal into smaller decimals in an array form.
e.g.
starting with 0.22335566
array(0) = 0.22
array(1) = 0.0033 or 3.3 *10-2
array(2) = 0.000055 or 5.5*10-4
etc.

can anyone help?
thanx a million

How Do You Convert Whole Numbers To Decimal Point Numbers?
I have this code and it adds 9+9 then divides by 4 which = 4.5 and places it in a text box, but it dosn't show the 5 after the point.

Code:a = 9: b = 9
 text(8).text = a+b
 text(8).text = text(8).text 4
 text(8).text = Format(text(8).text, "#.##")

Whats wrong here?

Thanks,
Bob K



Edited by - Bob K on 3/17/2005 7:17:06 PM

How To Add Numbers (5 Different Numbers-add Them One After Another From A File-it's The Dynamic Arra
How to add numbers (5 different numbers-add them one after another from a file-it's the dynamic array) to an array and how to get these numbers out of the array? -thanks detailed code please

Do/Loop,Need To Nest Another Loop To Check For Duplicates(FIGURED IT OUT)
check it out, what i am doing is reading in from my DB, customer orderID's. The table that i am reading from will have multiple OrderID's and some will be duplicates. That all fine but i dont want to have order number 115 show up 3 times when 1 time would be enough. This is the loop that i am using and am loading the values in the the combo box. What i would like to do, is once i hit this line of code

Combo2.List(i) = ![OrderID]

then do either a for each , or for next loop to walk through the contents of combo2 and check for a duplicate, if a duplicate is found i would like to take the current orderID that was just loaded out of the combo2 box. I have tried a for each loop but i am not geting the syntax correct of what exactly i am trying to search through. That where you guys come into play. could some one please help with this problem

Do Until .EOF
   Combo2.List(i) = ![OrderID]
   i = i + 1
   .MoveNext
Loop

This is what i would like to accomplish.
DO Until .EOF
    load orderID into combo box
        For Each orderID in combo box
             If duplicate found then
                  delete current entry
             end if
         next
     continue loading orderid's
loop



Edited by - lmf232s on 7/24/2003 1:59:30 PM

Game Loop Without Creating An Endless Loop?
im trying to setup a loop for my game to draw the scene as many times as it can each second, however, i end up simply creating a loop that stops basically everything. timers do not function, command buttion clicks are ignored, not what i wanted.

so, then i tried a timer, but even at a setting of 1 it was too slow for my purpose. (unless you want to play the game limited to 10 FPS ) so, is there any faster timer system, or a differnt loop system i didnt think of?
thanks

Sorting Texts And Numbers As If It Was All Numbers
Hi,

I have a list of appartement numbers. Sometimes it's written 102 or sometimes 102a and 102b.

E.G

102
103
104a
104b
105
(...)

Actually, if I record a macro to sort those valuesm it puts 104a and 104b at the end of the list, without considering them as numbers which are locally before 105. Note that it could be one, two, three or more digits. It would be a dynamic lenght. The letter too could be dynamic as well.

Is there a way to tell Excel/VBE to sort intelligently this list?

Thx!

Werner



Code:

Sub Sorting()

Rows("16:29").Select
Selection.Sort Key1:=Range("A16"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

Random Numbers--same Numbers/different Order
HI, I'd like to display 4 numbers randomly. I would like the same 4 numbers to be displayed each time the random code runs but in a different order each time.

I'v etried the ran() function but it doesn't quite do the job.

Any ideas?

How To Get Only The Numbers From A String Of Numbers And Characters?
anyone out there know how to isolate only the integers from a string like so...

12/2/2002
1/11/2002

note the varying length of the day and month values in the date examples....

thx for helping ^_^

Compare Numbers And Save Numbers
Hi pros,
set 1 52
set 2= 1325
Now i make a compare these two set of numbers.
if mid(set1,Acounter,1)<>mid(set2,Bcounter,1)then
set 1 first no.1 match with set 2 no.1 =right number
IF set 1 no.2 match with set 2 no.2 but at third position once it match will end the loop. How can i save the set 2 no.5 in fourth position?

Thank you.


Yahoo! Biztools
- Promote your business from just $5 a month!

Enter Numbers From A Set Of Numbers, But Only Allow It To Be Entered Once.
Hi all,

I am trying to make an app for work, what I want to do is

1. Create a list of numbers, no real order and they will be added to and removed from as well
2. I then want to add them in a form (similar to an excel spreadsheet) with text boxes as I need them and I should only be able to add them once, ie.. no duplicate numbers

I hope this is not too vague. Thanks


Regards

David

Generating Random Numbers, Whole Numbers Only
hello all!

I used this code to generate random numbers in VB:
Code:lRndNum = (65000 * Rnd)

where I wanted to produce a bunch of random numbers from 0 to 65000.
My problem is, I want to discard the decimal points in the generated random result.

I only want to have random numbers, whole numbers, that is, without the messy decimal point.

I hope you'll hear me out. Thanks!

PABX-COM PORT - URGENT-URGENT-URGENT PLS
Experts,

I need to write a program to get the tel.call detail such as extensionno, callid , duration of the call from our pbx system.
i used mscomm control and did the following.


Private Sub MSComm_OnComm()

Dim sIncomming
    Select Case MSComm.CommEvent
        Case comEvReceive
            Do
                sIncomming = MSComm.Input
                txtIncomming.Text = txtIncomming.Text & sIncomming
            Loop While MSComm.InBufferCount
    End Select

End Sub

But it's not working. How do I resolve my problem ?
Please help me out to solve this problem ? it's very very urgent pls.

Creating A Dataset In A Loop (i.e. For .....next Loop)
Dear Expert,

I'm having problems creating a dataset in a for __ next loop which I intend loading into a crystal report writer.

Please provide me with a sample code to perform the above.

Thanks

URGENT-URGENT::Making A Excel Chart In VB Form From MSHFlexGrid &amp; Displaying It
I have the following problem:

Making a Excel chart in VB Form from MSHFlexGrid & Displaying it[]

 - can some one help please!!



 

Urgent Urgent Help. Copy Hello.txt To Text Box On URL And Auto Click On The Button In
Dear sir and mdm,

I am currently doing a school prj involved visual basic 6.0 which I get stuck in midway and I had tried for the past few wks searching for books and website for ideas or solution. Hope u all can help me.

I have this hello.txt file in which there is some English sentences. I want to copy these sentence to an URL www.freetranslation.com where there is a textbox on the URL for people to key in English text and click on the translation button in the URL.

I have managed to open the website using

Private Sub text_translation_Click()

Dim R As Long

R = ShellExecute(0, "open", "www.freetranslation.com", 0, 0, 1)

End Sub

Problem
(1) I could not do a copy and paste function from hello.txt to the textbox in the URL

(2) I could not perform auto click function on the translation button in the URL after text is entered.

I have only visual basic 6.0 and visual C++ but the build-on is on visual basic platform and no java

Thanks a lot…

Loop The Loop: Adding List Item And Sub-items Assigned To Items.
Hello there,

below are the codes i've written to record all the items (which are qnsID) in list box (List1) into qnsdata_table.


Code:
Private Sub Command6_Click()
Dim x As Integer
Dim y As Integer

x = List1.ListCount
y = 0

rst.Open "SELECT * from qnsdata_table", cn, adOpenDynamic, adLockOptimistic

Do While Not y = x
rst1.Open "SELECT qnsdataID from autonumber", cn, adOpenDynamic, adLockOptimistic
rst.AddNew
rst!qnsDataID = "qd" & Right("000000" & CStr(CInt(rst1!qnsDataID) + 1), 6)
rst!qnsID = Me.List1.ItemData(y)
rst.Update
rst1.Close
rst1.Open "UPDATE autonumber SET qnsdataID = qnsdataID +1", cn, adOpenDynamic, adLockOptimistic
y = y + 1
Loop

rst.Close
End Sub


The problem is that for each item (qnsID) there are several assigned (ansID) and i need them to be recorded along with the qnsID, into qnsdata_table.
______________________________
| qnsdataID | qnsID | ansID |
-----------------------------------
| qd0001 | qns0002 | ans0012 |
| qd0002 | qns0002 | ans0016 |
| qd0003 | qns0002 | ans0001 |
------------------------------------

In this case, should i have another Do While Loop within the current Loop, to find out how many 'ansID' there are which are assigned to each 'qnsID'.

I've tried


Code:
rst2.Open "SELECT Count(ansID) AS ansID_count FROM ans_table where....(conditions)

Me.Text2 = rst2!ansID_count '(ive no idea where to store the count) value)

a = Me.Text2 '(shift value into variable a)
b = 0
and here goes another loop, but it didn't work.

Need some advice and comments from you guys =)

Thanks a million.

Astrov

*URGENT* Saving Information From A Lsit *URGENT*
How do I save information from a list into a sequential file??
right now I am using this...

Code:
Open "C:Documents and SettingsAndrewMy DocumentsAndrewLibrary CatalogBooksTitle.txt" For Append As #1
Write #1, lstTitle.Text
Close #1
Open "C:Documents and SettingsAndrewMy DocumentsAndrewLibrary CatalogBooksAuthor.txt" For Append As #2
Write #2, lstAuthor.Text
Close #2
Open "C:Documents and SettingsAndrewMy DocumentsAndrewLibrary CatalogBooksGenre.txt" For Append As #3
Write #3, lstGenre.Text


But all it does is save "" to the files.
How can I save the actual information displayed in the list????
Please, somebody help me, It's really urgent.

MDAC2 Or MDAC 2.X And DataGrid - Urgent Urgent
I wrote a program
My ConnectionString is: conAcc.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & App.Path & "Acc.mdb"
My Database is Access 97
I have not Permission to install VB on other stations and I am obligate to install my program in other stations.
When I make my setup files and run it on other stations I must install MDAC too to estabilish Connection
Because of My Connection sting I must Install MDAC 2.0 I download two MDAC_Type Files but their volumes are not similar one of them is 5,320 KB and another one is 7,935 KB
Which of them is correct?
When I changed My Connection String to :
= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "Acc.mdb"
My Data Grids do not Work
Is there any solutions for my Grids?
Thanks in Advance

Copyright © 2005-08 www.BigResource.com, All rights reserved