Terence-
CurrentDb gets rebuilt every time you reference. You're setting a Database object, so use that. Like this:
Dim lngRowsInserted As Long
Set db = CurrentDb()
mysql = "Insert into tbl_employee_payment select * from sheet_pay"
db.Execute mysql, dbFailOnError
' the below 3 lines should work - but they always return zero instead
MsgBox (db.RecordsAffected)
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of buffalome000@yahoo.com
Sent: Tuesday, December 10, 2013 12:44 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] recordsaffected property
Greetings all, it's been a long time since i have written in this group, Tit's terence/buffalome90210, I am using ms access 2007, on a xp platform and always get a zero result for the recordsaffected property, what am i doing wromg ?
terence
Dim lngRowsInserted As Long
Set db = CurrentDb()
mysql = "Insert into tbl_employee_payment select * from sheet_pay"
CurrentDb.Execute mysql, dbFailOnError
' the below 3 lines should work - but they always return zero instead
MsgBox (CurrentDb.RecordsAffected)
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar