Hollis,Virginia
HollisVJ at pgdp.usec.com
Fri Jun 11 09:49:16 CDT 2004
I used your suggestion & it solved that problem.
But I am still getting errors in other places for example: .FindFirst
"[FailureTimeID]= " & right.ItemData(i) & " And [FailureReportNo]= " &
Me!FailureReportNo. I get an error on the last Me!FailureReportNo that
Method or Member not found. I have never had that error before and have been
using this database for years. I am getting compile errors on a lot of code.
What can I do??
Virginia
*************
EXPLICITLY DECLARE YOUR VARIABLES!
Dim db as DAO.Database
Dim RS as DAO.Recordset
Otherwise you are at the whim of how the references are listed and whatever
Access finds first as a suitable reference library.
-Chris Mackin
-----Original Message-----
From: Hollis,Virginia [mailto:HollisVJ at pgdp.usec.com
<http://databaseadvisors.com/mailman/listinfo/accessd> ]
Sent: Friday, June 11, 2004 5:19 AM
To: 'accessD at databaseadvisors.com
<http://databaseadvisors.com/mailman/listinfo/accessd> '
Subject: [AccessD] Change code to A2003
I have been using the below code to count the number of hits on a form. I
installed A2003 yesterday & receive an error on RS.Edit. In A2K I added a
reference to DAO 3.6 & the code would work. But in 2003 this is not listed
in the references.
What can I change the code to so it will work correctly?
Virginia
********************
Public Function CountThisForm(frm As Form) As Boolean
Dim db As Database
Dim RS As Recordset
Dim SQL As String
Set db = CurrentDb
SQL = "Select * FROM tblCounter Where FormName = """ & frm.Name & """;"
Set RS = db.OpenRecordset(SQL, dbOpenDynaset)
If RS.RecordCount > 0 Then
RS.Edit
RS!HitCount = RS!HitCount + 1
RS.Update
Else
RS.AddNew
RS!FormName = frm.Name
RS!HitCount = 1
End If
RS.Close
Set RS = Nothing
End Function
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
<http://databaseadvisors.com/mailman/listinfo/accessd>
http://databaseadvisors.com/mailman/listinfo/accessd
<http://databaseadvisors.com/mailman/listinfo/accessd>
Website: http://www.databaseadvisors.com <http://www.databaseadvisors.com>