Dan Waters
dwaters at usinternet.com
Sat Nov 4 19:42:27 CST 2006
Bill, You might try changing the name CALL-TYPE to something else. I've found that I can't use the words Level or Note for the names of fields in tables. Also, try removing the underscore from the field name. I think in general, all field names should be a continuous stream of letters and numbers (with a letter as the first character). Doing this removes a possibility for error. Also, when you are in the code editor screen, select Tools|References, then see if there are any references missing. If so, the word MISSING should precede the name of the reference that should be there. Hope this helps, Dan -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Morrill Sent: Saturday, November 04, 2006 4: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