Runtime Error: 3146

S

SF

I have just upsize my backend to SQL Server 2005. I have reconnected my
front end to SQL Server thru ODBC connection. While trying to add new
record, I received the Runtime Error 3146.

Dim varObjectid As Long
Dim dbs As DAO.Database
Dim rstObject As DAO.Recordset
Set dbs = CurrentDb

Set rstObject = dbs.OpenRecordset("SELECT * FROM tblObjects",
dbOpenDynaset, dbSeeChanges)
rstObject.AddNew
rstObject![DateCreated] = Now()
rstObject![CreatedBy] = CurrentUser()
rstObject![DateUpdate] = Now()
rstObject![Owner] = CurrentUser()
rstObject![Pc_Name] = ComputerName
rstObject.Update
rstObject.Bookmark = rstObject.LastModified
varObjectid = rstObject![Ob_ObjectID]
rstObject.Close
 
D

Dirk Goldgar

SF said:
I have just upsize my backend to SQL Server 2005. I have reconnected my
front end to SQL Server thru ODBC connection. While trying to add new
record, I received the Runtime Error 3146.

Dim varObjectid As Long
Dim dbs As DAO.Database
Dim rstObject As DAO.Recordset
Set dbs = CurrentDb

Set rstObject = dbs.OpenRecordset("SELECT * FROM tblObjects",
dbOpenDynaset, dbSeeChanges)
rstObject.AddNew
rstObject![DateCreated] = Now()
rstObject![CreatedBy] = CurrentUser()
rstObject![DateUpdate] = Now()
rstObject![Owner] = CurrentUser()
rstObject![Pc_Name] = ComputerName
rstObject.Update
rstObject.Bookmark = rstObject.LastModified
varObjectid = rstObject![Ob_ObjectID]
rstObject.Close


3146 is just the general "ODBC--call failed" error. You may get more
information by examining the contents of the DBEngine.Errors collection
immediately after the error is raised.
 
S

SF

Could should shed some light? How to capture that DBEngine.Errors error?

SF
Dirk Goldgar said:
SF said:
I have just upsize my backend to SQL Server 2005. I have reconnected my
front end to SQL Server thru ODBC connection. While trying to add new
record, I received the Runtime Error 3146.

Dim varObjectid As Long
Dim dbs As DAO.Database
Dim rstObject As DAO.Recordset
Set dbs = CurrentDb

Set rstObject = dbs.OpenRecordset("SELECT * FROM tblObjects",
dbOpenDynaset, dbSeeChanges)
rstObject.AddNew
rstObject![DateCreated] = Now()
rstObject![CreatedBy] = CurrentUser()
rstObject![DateUpdate] = Now()
rstObject![Owner] = CurrentUser()
rstObject![Pc_Name] = ComputerName
rstObject.Update
rstObject.Bookmark = rstObject.LastModified
varObjectid = rstObject![Ob_ObjectID]
rstObject.Close


3146 is just the general "ODBC--call failed" error. You may get more
information by examining the contents of the DBEngine.Errors collection
immediately after the error is raised.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

SF said:
Could should shed some light? How to capture that DBEngine.Errors error?


Here's a function that I use in an error-logging routine to build a string
of those errors:

'----- start of function code -----
Function fncODBCErrors() As String

Dim strODBCErrors As String
Dim intI As Integer

' Collect ODBC errors (if any) for reporting.
strODBCErrors = vbNullString
With DBEngine.Errors
For intI = 0 To (.Count - 1)
strODBCErrors = strODBCErrors & "|" & _
.Item(intI).Number & " " & _
.Item(intI).Description
Next intI
End With
If Len(strODBCErrors) > 0 Then
strODBCErrors = strODBCErrors & "|"
End If

fncODBCErrors = strODBCErrors

End Function
'----- end of function code -----

For a quick check of the errors, when the 3146 error is raised, you might
call the function from the immediate window:

?fncODBCErrors
 
O

OD

Did you find a solution to this problem.
I have the exact code to add a new row to a linked oracle table in Access
and I get the error ODBC--call failed the number is 3146. I can run queries
just fine with no errors agains this linked table in Access. Only using a
recordset.addnew option failes when it is executing recordset.update.
Everything worked when this linked table was accessing a table in Oracle 9i.
I have upagraded my database to 10g and imported the same table to an Oracle
10g database and recreated the link in Access using an ODBC connection. same
code that worked on a 9i linked table does not work with a 10g linked table.

Please let me know if you found a solution.

Thanks,

OD
 

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