Microsoft Access Run-time Error 3146
Contents |
be down. Please try the request again. Your cache administrator is webmaster. Generated Thu, 20 Oct 2016 15:50:51 GMT by s_wx1126 (squid/3.5.20)
2002. The following code segment executes the first read, from rs, successfully, but gives me a "Run-time error 3146 ODBC--call failed" on the second one from rs1. Both rs and rs1 are queries. Can anyone give me information on this error? ms access error 3146 Dim db as Database Dim rs as Recordset Dim rs1 as Recordset Dim strUserID as String
Odbc Call Failed Access 2013
Dim strProgram as String Set db = CurrentDb Set rs = db.OpenRecordset("SELECT program_id FROM sysuser WHERE sysuser_id = '" & strUserID & "'", dbOpenDynaset) rs.MoveFirst strProgram = rs!program_id If Right(strStartLoc, 2) = "10" Then Set rs1 = db.OpenRecordset("SELECT * FROM report_db WHERE enabled = '" & strUserID & "'", dbOpenDynaset) .... End If -- Carol Guest, Jun 9, 2005 #1 Advertisements Guest Guest http://answers.microsoft.com/en-us/msoffice/forum/msoffice_access-mso_other/access-2007-odbc-call-failed-error-3146-only-on/27172fb8-958f-4222-be8e-9083541c8891 Try and run the queries, see if you get this error message. Running the query, not by code, will give you the odbc call failed, and then it will give another message, of what is the real error. If the query will run, then run the code, put a break before the open recordset, copy the string of the SQL to the immidiate window ?"SELECT program_id FROM sysuser WHERE sysuser_id = '" & strUserID & "'" and copy it to a http://www.pcreview.co.uk/threads/run-time-error-3146-odbc-call-failed.1865044/ new query and run, it will give you the real error. And as a side note 1. try and run the tables, mybe you are not connected to the server 2. Is user id is text type, if not then the sql should look like "SELECT program_id FROM sysuser WHERE sysuser_id = " & strUserID "Carol Grismore" wrote: > I am using Access 2002. The following code segment executes the first read, > from rs, successfully, but gives me a "Run-time error 3146 ODBC--call > failed" on the second one from rs1. Both rs and rs1 are queries. Can anyone > give me information on this error? > > Dim db as Database > Dim rs as Recordset > Dim rs1 as Recordset > Dim strUserID as String > Dim strProgram as String > > Set db = CurrentDb > Set rs = db.OpenRecordset("SELECT program_id FROM sysuser WHERE sysuser_id = > '" & strUserID & "'", dbOpenDynaset) > > rs.MoveFirst > strProgram = rs!program_id > > If Right(strStartLoc, 2) = "10" Then > Set rs1 = db.OpenRecordset("SELECT * FROM report_db WHERE enabled = '" & > strUserID & "'", dbOpenDynaset) > .... > End If > > -- > Carol Guest, Jun 9, 2005 #2 Advertisements Guest Guest These are some good ideas, but I have actually done all this and no errors occur. Any further ideas would be appreciated. -- Carol "Ofer" wrote: > Try and run t
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us http://stackoverflow.com/questions/730414/determine-real-cause-of-odbc-failure-error-3146-with-ms-access Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow http://www.vbforums.com/showthread.php?338252-RUNTIME-ERROR-3146-ODBC-Call-Failed Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Determine real cause of ODBC failure (error 3146) error 3146 with ms-access? up vote 6 down vote favorite 2 My client is using Access as a front end to a SQL Server database. They recently started getting ODBC - 3146 errors from time to time when running some reports. From what I can tell, this is just a generic ODBC call failed error. I've tried sticking some error handling in the VB script that is launching the reports, time error 3146 but I am not having any luck getting extra error information. Code looks a bit like this. Public Function RunReports() On Error GoTo MyErrorTrap DoCmd.OpenReport "blah", acViewPreview DoCmd.Close DoCmd.OpenReport "foo", acViewPreview DoCmd.Close Exit_function: Exit Function MyErrorTrap: Dim errX As DAO.Error Dim MyError As Error If Errors.Count > 1 'This always seems to be 0, so no help For Each errX In DAO.Errors 'These are empty even if dont check for Errors.Count Debug.Print "ODBC Error" Debug.Print errX.Number Debug.Print errX.Description Next errX Else Debug.Print "VBA Error" Debug.Print Err.Number Debug.Print Err.Description End If 'Also have tried checking DBEngine.Errors, but this is empty too End Function I've also enabled tracing on the ODBC side, but that has bogged things down way too much, and I am so far unable to recreate the ODBC error. I am completely open for suggestions on how to diagnose this. vba ms-access vbscript odbc share|improve this question edited Jun 16 '14 at 20:23 Smandoli 5,00122862 asked Apr 8 '09 at 14:57 Aaron Hinni 11k43134 add a comment| 2 Answers 2 active oldest votes up vote 5 down vote Use the DbEngine.Errors collection. Sub Update_Temp() On Error GoTo ErrorTrap ' Execute connect code at this point Exit_errortrap: Exit Sub ErrorTrap:
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 4 of 4 Thread: RUNTIME ERROR '3146'..ODBC-Call Failed Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode May 9th, 2005,11:41 PM #1 nagasrikanth View Profile View Forum Posts Thread Starter Hyperactive Member Join Date Nov 2004 Location India,Hyderabad. Posts 420 RUNTIME ERROR '3146'..ODBC-Call Failed Hi.. Im using SQL server as my backend and MS Access as F.E.. Im using to update around 10 to 20 records one by one by upto 2 to 3 records it was updating, later for 4th record it was saying "RUNTIME ERROR '3146'..ODBC-Call Failed"(at "rst.update" it was showing) ..at that time if i start agian from "rst.addnew" then for upto 3 to 4 it was okay..Is there any limitation in adding records.??? FYI: Im not getting if i update 1 or 2 records..and one more thing that i came to know was ,If the table was a ordinary Access Table..Im not getting any error.. One more thing was If i place some time delay using msgbox (like msgbox "Updated..." for example)that means for each record I placed a message updated..then it was working perfectly on to my surprise.. Please help me in this regard..Please.. Thanks & regards Anu... Reply With Quote May 9th, 2005,11:46 PM #2 RobDog888 View Profile View Forum Posts Visit Homepage Super Moderator Join Date Apr 2001 Location LA, Calif. Raiders #1 AKA:Gangsta Yoda™ Posts 60,221 Re: RUNTIME ERROR '3146'..ODBC-Call Failed Sounds like your updating/adding records through Access tables/queries and not directly to the SQL tables? Alos, probably using a recordset to add/update when you could execute a sql INSERT statement or an sql UPDATE statement. Recordsets are slow. You can create a connection to SQL using ADO, DAO, ODBC to perform your actions. VB/Office Guru™ (AKA: Gangsta Yoda™ ®) I dont answer coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP