M
Mhebor
Hi,
I'm new to posting so please bare w/ me. Currently using A2K. I'm
having a problem getting a querydef to work. I know for a fact that it
is only reading the first record. If I have 4 records in my query, it
runs thru the code 4 times, but it is only reading the first record.
Here's the code.
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim stDocName
Dim rst As Recordset
Dim i As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("qrycount1")
Me!won1 = 0
Me!won2 = 0
Me!won3 = 0
Me!won4 = 0
With rst
rst.MoveFirst
Do Until .EOF
If Me!ckchdgt1 = -1 Then
Me!won1 = Me!won1 + 1
End If
If Me!ckchdgt2 = -1 Then
Me!won2 = Me!won2 + 1
End If
If Me!ckchdgt3 = -1 Then
Me!won3 = Me!won3 + 1
End If
If Me!ckchdgt4 = -1 Then
Me!won4 = Me!won4 + 1
End If
rst.MoveNext
Loop
End With
Set rst = Nothing '
Long story short, I want to count the number of times a chkdgit has a
value of -1. If ckchdgt1 has a -1 value in rec #2 and 3, the Me!won1
value is 0 or if rec 1 and 4 has avalue -1, then Me!won1 results in a
value of 4.
Thanks in advance.
I'm new to posting so please bare w/ me. Currently using A2K. I'm
having a problem getting a querydef to work. I know for a fact that it
is only reading the first record. If I have 4 records in my query, it
runs thru the code 4 times, but it is only reading the first record.
Here's the code.
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim stDocName
Dim rst As Recordset
Dim i As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("qrycount1")
Me!won1 = 0
Me!won2 = 0
Me!won3 = 0
Me!won4 = 0
With rst
rst.MoveFirst
Do Until .EOF
If Me!ckchdgt1 = -1 Then
Me!won1 = Me!won1 + 1
End If
If Me!ckchdgt2 = -1 Then
Me!won2 = Me!won2 + 1
End If
If Me!ckchdgt3 = -1 Then
Me!won3 = Me!won3 + 1
End If
If Me!ckchdgt4 = -1 Then
Me!won4 = Me!won4 + 1
End If
rst.MoveNext
Loop
End With
Set rst = Nothing '
Long story short, I want to count the number of times a chkdgit has a
value of -1. If ckchdgt1 has a -1 value in rec #2 and 3, the Me!won1
value is 0 or if rec 1 and 4 has avalue -1, then Me!won1 results in a
value of 4.
Thanks in advance.