Hello, I am making a program that has a feature that will read a field in an access file (the field is called "Ratio"). I am wondering how I would go about when I perform the
Data1.Recordset.MoveNext, it will compare the number in "txtRatio.text" to all the numbers in the "Ratio" column for each record. If the Ratio is within +/- 10%, list them in a listbox.
Last edited by LostAngel; Sep 27th, 2003 at 11:32 PM.
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
you may definately need to open another recordset to same table and put some code like this in data1 reposition event
With data2.Recordset
.MoveFirst
Do While .EOF = False
tRatio = .Fields("Ratio")
sRatio = Data1.Fields("Ratio")
If tRatio >= sRatio Then
If (tRatio - sRatio) <= 10 Then
List1.AddItem tRatio
End If
ElseIf tRatio < sRatio Then
If (sRatio - tRatio) < 10 Then
List1.AddItem tRatio
End If
End If
Loop
End With
by the way don't forget to put filter DATA2 to skip loading current selected recordset in Data1.
Thank you for your reply, but I am still a little confused...
Would you possibly be able when you get time to make a small example program ? I would greatly appreciate it. I am still rather new at databases.
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
Hello, what would I do to convert this program to DAO? This is the type that I have been using in the rest of my program. Also, when I tried to run the program it came up with an error: DBconn.CursorLocation = adUseClient.
Is it hard to convert to DAO?
Last edited by LostAngel; Sep 27th, 2003 at 01:29 PM.
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
what ado version you're using ? get the latest one and latest VB Service pack 5 and I would recommend you move to ADO because DAO doesn't support link to same table twice and you have to do alot of tricks to and query stuff to do that... you remove cursorlocation for now and see if its work
I am currently downloading MDAC 2.8, I will tell you if it works when it's done. Thanks for your advice on using ADO.
*REVISED*
Thank you very much, The program now works without any problems. Will it be that hard for me to go from DAO to ADO seeings I am used to DAO?
Last edited by LostAngel; Sep 27th, 2003 at 06:26 PM.
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If