SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


MS Access - ADO Connection - Method or Member not found Error


MS Access - ADO Connection - Method or Member not found Error

Author
Message
sunnyjoshibombay
sunnyjoshibombay
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 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
MyTableRs.MoveFirst
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")
Else
MsgBox ("Employee found in attendance")
End If
Loop
MyTableRs.Close
Set MyTableRs.ActiveConnection = Nothing
Conn.Close
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
Michael Earl-395764
Michael Earl-395764
SSCertifiable
SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)

Group: General Forum Members
Points: 6717 Visits: 23078
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search