Add record with ODBC Connection

S

SAC

I have an ODBC connection to a sql server db.

I'm trying to add a record using dao recordset. I get the error: "ODBC Call
Failed."

Here's the code:

Function TestTmp()
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("dbo_tblTmpQuery3Test", dbOpenDynaset,
dbSeeChanges)
rs.AddNew
rs!PHENDT = 1

rs.Update
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing

End Function

I get the error on the rs.Update line.

Thanks.
 
D

Dave Patrick

I like to ADD this trap in to raise the SQL error.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q154510

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|I have an ODBC connection to a sql server db.
|
| I'm trying to add a record using dao recordset. I get the error: "ODBC
Call
| Failed."
|
| Here's the code:
|
| Function TestTmp()
| Dim db As Database
| Dim rs As Recordset
| Set db = CurrentDb
| Set rs = db.OpenRecordset("dbo_tblTmpQuery3Test", dbOpenDynaset,
| dbSeeChanges)
| rs.AddNew
| rs!PHENDT = 1
|
| rs.Update
| rs.Close
| db.Close
| Set rs = Nothing
| Set db = Nothing
|
| End Function
|
| I get the error on the rs.Update line.
|
| Thanks.
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top