Ms Access Vba Error 3146
Contents |
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, error 3146 access select the forum that you want to visit from the selection below. Results 1 error 3146 odbc call failed to 5 of 5 Thread: ODBC - Connection Failed Error 3146 Tweet Thread Tools Show Printable Version Subscribe to this Thread… run time error 3146 odbc call failed access 2010 Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 05-05-09,19:17 #1 shanmugha View Profile View Forum Posts Registered User Join Date May 2009 Posts 8 Unanswered: ODBC - Connection
Run Time Error 3146 Odbc Call Failed Oracle
Failed Error 3146 Hi, I have a situation here.I will be glad if anyone could help. We have a Microsoft Access 2003 accessing the SQL Server 2000 database using ODBC connection.I have set the database as a System Datasource with SQL Server driver and the connection settings. When i launch the .mdb application,i am able to connect to the database and fetch results.But only while populating the data on one of access macro error 3146 the combobox,the ODBC connection failed error 3146 arises. I turned on the tracing and saw that the SetConnection Attr failed error in the log. Any help is highly appreciated. Thanks in advance. Reply With Quote 05-05-09,20:24 #2 pkstormy View Profile View Forum Posts Moderator Join Date Dec 2004 Location Madison, WI Posts 3,926 Are you able to enter data for this field directly into the table? If not, are you able to enter data in this field directly into the SQL Server table (I'm guessing yes.) You can also try refreshing (or delete and relink) the linked tables. You can also put in a msgbox me!MyProblemField in the AfterUpdate (or BeforeUpdate) event to see what value is actually being saved in the combobox and see if it matches the SQL Server field type. I'm not sure what the error exactly means but these are some things I normally do to troubleshoot. My guess is that you may not be passing the correct value type for that field (what is the field type defined as on SQL Server?) Or it's a relational problem. Can you explain more on what kind of field type (and what it's for) that is giving you problems? Last edited by pkstormy; 05-05-09 at 20:34. Expert Database Progr
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 Learn more about Stack Overflow the company Business Learn more run time error 3146 odbc call failed mysql about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow 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) with ms-access? up vote 6 down vote favorite 2 My client is using Access as a front end to http://www.dbforums.com/showthread.php?1642114-ODBC-Connection-Failed-Error-3146 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, 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 http://stackoverflow.com/questions/730414/determine-real-cause-of-odbc-failure-error-3146-with-ms-access 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: Dim myerror As Error For Each myerror In DBEngine.Errors With myerror If .Number <> 3146 Then MsgBox .Description End If End With Next Resume Exit_errortrap End Sub share|improve this answer answered Jun 16 '14 at 20:22 Smandoli 5,00122862 My "Error" type doesn't have .Number or .Description -- is something supposed to be different? –AnotherParker Aug
Posters Today's Posts Search Community Links Social Groups Pictures & Albums Members List Calendar Search http://www.access-programmers.co.uk/forums/showthread.php?t=280228 Forums Show Threads Show Posts Tag Search Advanced Search Find http://www.pcreview.co.uk/threads/run-time-error-3146-odbc-call-failed.1865044/ All Thanked Posts Go to Page... Thread Tools Rating: Display Modes 08-19-2015, 10:15 AM #1 Rx_ Nothing In Moderation Join Date: Oct 2009 Location: Denver, Colorado Posts: 2,633 Thanks: 557 Thanked 308 Times in 282 Posts Update error 3146 to error 3146 ODBC--call failed. SQL Server Linked Tables Does anyone have additonal reasons for Error 3146 besides Required Field? Suspected the problem was a Required Field on the SQL Server Linked Table. Sure enough it was. There seem to be other alternatives listed. MSACCESS 2010 MSAccess Error 3146 using linked tables error 3146 odbc to SQL Server 2008 R2. Didn't find any post that directly mention the Required Field. Perhaps this post will help others. The code below has one required field commented out. When the comment is removed, the code worked perfectlly and appends the new record. This is an old thread as an example: RE: http://www.access-programmers.co.uk/...d.php?t=155472 Another from the Microsoft Community that actually solved the problem in a different way: http://answers.microsoft.com/en-us/o...e-9083541c8891 In addition, some of the Microsoft site solutions don't exactly point out the Required Field at all. Code for an Append new record - works if uncommenting the ID_Area, a Required Field on the linked SQL Server Table. Code: Public Function AppendRecordNavDataToRegulatory() As String ' change to private after testing Dim strSQLWells As String ' create Wells recordset Dim rst As DAO.Recordset ' On Error GoTo Err_WellWellAnotherFineMessYouGotUsIn strSQLWells = " SELECT Wells.ID_Wells, Wells.Well_Name, Wells.WName, Wells.WNumber, Wells.WSection, Wells.WDesc, " & _ " Wells.ID_WellsStatus1, Wells.ID_Area, Wells.ID_County, Wells.ID_Prodg_Fmn, Wells.WellTypeID,
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 #1 Advertisements Guest Guest 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 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 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 ano