Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

MS Access - ADO Connection - Method or Member not found Error Expand / Collapse
Posted Thursday, May 15, 2008 3:15 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 3, 2008 3:48 AM
Points: 6, Visits: 15
Dear all Gurus / Masters
I do have another problem as follows
I am trying to loop in the record set of one table, my code is as follows
The following code is on a click event of a push button on a form

-- code starts here
Dim Conn As ADODB.Connection
Set Conn = New ADODB.Connection
Conn.Provider = "Microsoft.jet.OLEDB 4.0"
Conn.Open "C:\Study\STUDY_PAYROLL.mdb"
Dim MyTableRs As ADODB.Recordset
Set MyTableRs = ADODB.Recordset
MyTableRs.Open "COM_EMPMST", Conn, adOpenDynamic, adLockPessimistic
Do Until MyTableRs.EOF
mychk = DCount("[EMP_CODE]", [ATT_IMPMST], "[att_emp_code] = [EMP_CODE] and [att_date] = #02/05/2008#")
If mychk = 0 Then
MsgBox ("Employee Not Found in Attendance")
MsgBox ("Employee found in attendance")
End If
Set MyTableRs.ActiveConnection = Nothing
Set Conn = Nothing

-- code ends

Now, when I run this code I am getting error "Method or Data Member Not Found"

Please help me, I don't know why I am getting this error

b rgds
sunil joshi
Post #501120
Posted Thursday, May 15, 2008 6:02 AM


Group: General Forum Members
Last Login: Tuesday, August 10, 2010 5:07 AM
Points: 2,661, Visits: 23,078
You need to go find an MS Access forum for this type of question. This has nothing to do with SQL Server.

I think your DCount function is wrong.
I think it should be:

DCount("[EMP_CODE]", "[ATT_IMPMST]", "[att_emp_code] = [EMP_CODE] and [att_date] = #02/05/2008#")

You would also be better off using a "SELECT COUNT([EMP_CODE])" T-SQL statement. I think DCount creates a cursor and loops through it.
Post #501207
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse