|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, June 03, 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 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
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Tuesday, August 10, 2010 5:07 AM
Points: 2,732,
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.
|
|
|
|