Bill Morrill
billmorrill at comcast.net
Sat Nov 4 16:33:35 CST 2006
Need help on the following DAO code. Using Access 2003 VBA reference set to
DAO 3.6 Object Library. When I go to compile the code below the compiler
lights up [CALL_TYPE] and stops. CALL_TYPE is a field in the
qryCallAttempt but the compiler doesn't seem to understand this. If I
comment out THE LINE strCallType = rst.CALL_TYPE then the compile stops at
the next line blnUnsuccessful = rst.UNSUCCESSFUL_ATTEMPT - same thing it
doesn't see rst.UNSUCCESSFUL_ATTEMPT – ANOTHER FIELD IN qryCallAttempt.
Need some illumination.
Thanks,
Bill
'_________________________________________________________________
DoCmd.Hourglass True
'declare object variables
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("qryCallAttempt")
'declare non-object variables to be used in loop
Dim intCounter As Integer
Dim strCallType As String
Dim blnUnsuccessful As Boolean
Dim blnDeactivate As Boolean
'initialize variable
intCounter = 0
rs.MoveFirst
Do While Not rst.EOF 'loop through each record in the query and set
Deactivated in the recordset where applicable
'initialize variables
rs.Edit
strCallType = rst.[CALL_TYPE]
blnUnsuccessful = rst.[UNSUCCESSFUL_ATTEMPT]
blnDeactivate = rst.[DEACTIVATE]
If strCallType = "Call 1" And blnUnsuccessful = True And
Forms!frmPatientAddUpdate!Program = "NON-SCALE MEMBER" Then
intCounter = intCounter + 1
If intCounter = 3 Then
'update current record set
blnDeactivate = True
Me![DEACTIVATE] = blnDeactivate
rst.Update
rst.Close
DoCmd.Hourglass False
Exit Sub
End If
End If
rst.Update
rst.MoveNext
Loop
DoCmd.Hourglass False
'_____________________________________________________