[AccessD] DAO Code won't Compile

Drawbridge, Jack: #CIO - BPI Drawbridge.Jack at ic.gc.ca
Mon Nov 6 10:30:39 CST 2006


Bill,

I believe the lines referring to columns in your recordset (ie
rst.[CALL_TYPE]) should use the ! Not the . ( ie rst![CALL_TYPE] )

Also, your sample refers to rs and rst which will cause a problem.
Believe the rs may be a typo - all should be the same either rs or rst.

Hope this helps.
jack

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Morrill
Sent: Saturday, November 4, 2006 5:34 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] DAO Code won't Compile

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

'_____________________________________________________
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list