Error 3709 Vba
Contents |
be..... If this is your first visit, be sure to check out the FAQ run time error 3709 the connection cannot be used by clicking the link above. You may have to run time error 3709 the search key was not found register before you can post: click the register link above to proceed. To start viewing run-time error '3709' requested operation requires an ole db messages, select the forum that you want to visit from the selection below. Results 1 to 11 of 11 Thread: Run-time error '3709' The runtime error 3709 vb6 connection cannot be..... Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Nov 23rd, 2010,03:00 PM #1 Patoh View Profile View Forum Posts Thread Starter Lively Member Join Date Nov 2010 Posts 71 Run-time error '3709' The
Error 3709 The Connection Cannot Be Used To Perform This Operation
connection cannot be..... Hey people! Watsup! i need your help am getting a Run-time error '3709': (The connection cannot be used to perform this operation. Its either closed or invalid in this context) when this code tries to execute. Can anyone see the problem i have tried re writing the sql to no avail. please help Code: Private Sub lvButtons_H1_Click() Dim MyCon As New ADODB.Connection Dim MyRs As New ADODB.Recordset 3709 Error Code: MyRs.Open "SELECT plans.Number, plans.plan, patients.fname, patients.lname , plans.phone number, plans.card number, plans.vcode, plans.expiry FROM plans LEFT JOIN patients ON plans.payerid = patients.number WHERE plans.plan='" & Me.Combo1.Text & "'" With DataReport9.Sections("Section1").Controls 'section1 mean that section you create in datareport .Item("rptpayid").DataField = MyRs("payerid").Name .Item("rptplan").DataField = MyRs("plan").Name .Item("rptname").DataField = MyRs("fname").Name .Item("rptlname").DataField = MyRs("lname").Name .Item("rptphone").DataField = MyRs("phone number").Name .Item("rptcard").DataField = MyRs("card number").Name .Item("rptvcode").DataField = MyRs("vcode").Name .Item("rptexp").DataField = MyRs("expiry").Name End With Reply With Quote Nov 23r
Forums Excel Questions Run time Error 3709 Results 1 to 8 of 8 Run time Error 3709This is a discussion on Run time Error 3709 within the Excel Questions forums, part of the Question Forums
Runtime Error 3709 Excel Vba
category; Code: Sub getdata() cur_mon = Date - (Weekday(Date, 2) - 1) cur_fri = 3709 error in vb Date + (5 - Weekday(Date, 2)) mondt ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to adodb.command error '800a0e7d' del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Nov 17th, 2009,04:39 AM #1 hsk Board Regular Join Date Oct 2006 Posts 563 http://www.vbforums.com/showthread.php?633744-Run-time-error-3709-The-connection-cannot-be Run time Error 3709 Code: Sub getdata() cur_mon = Date - (Weekday(Date, 2) - 1) cur_fri = Date + (5 - Weekday(Date, 2)) mondt = Year(cur_mon) & "-" & Day(cur_mon) & "-" & Month(cur_mon) & " 00:00:00" fridt = Year(cur_fri) & "-" & Day(cur_fri) & "-" & Month(cur_fri) & " 00:00:00" mydb = ............... (my sheet name) mypath = ...... (path C:\ ...etc) & mydb ' Connet to database Dim cn As http://www.mrexcel.com/forum/excel-questions/430015-run-time-error-3709-a.html ADODB.Connection Set cn = New ADODB.Connection With cn .Provider = "MSDASQL" .ConnectionString = "Driver={Microsoft Excel Driver (*.xls)};" & "DBQ=" & mypath & "; ReadOnly=False;" .Open End With Set rs = New ADODB.Recordset rs.Open "SELECT * FROM [Sheet1$]" cn.Close Set cn = Nothing End Sub I am trying to query a sheet , getting run time error 3709 on the line rs.Open. any help ? Share Share this post on Digg Del.icio.us Technorati Twitter Thanks, hsk Progress is not made by early risers, but by the LAZY people, trying to find easier ways to do the same ! Reply With Quote Nov 17th, 2009,04:56 AM #2 Richard Schollar MrExcel MVPModeratorInactive Join Date Apr 2005 Location UK Posts 23,696 Re: Run time Error 3709 You need to tell it which connection to use: Code: rs.Open "SELECT * FROM [Sheet1$]", cn Share Share this post on Digg Del.icio.us Technorati Twitter Richard Schollar Using xl2013 Reply With Quote Nov 17th, 2009,04:56 AM #3 Andrew Poulsom MrExcel MVPModerator Join Date Jul 2002 Posts 73,092 Re: Run time Error 3709 This may help you: http://support.microsoft.com/kb/257819#RetrieveExcel Share Share this post on Digg Del.icio.us Technorati Twitter Microsoft MVP - Excel Reply With Quote Nov 17th, 2009,05:19 AM #4 hsk Board Regular Join Date Oct 2006 Posts 563 Re: Run tim
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question http://www.codeproject.com/Questions/557798/VB-plusrun-timepluserrorplus-plustheplusconnect View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> error 3709 System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & time error 3709 The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ VB6 run-time error 3709 the connection cannot be used to perform the operation-it is either closed or invalid Rate this: Please Sign up or sign in to vote. See more: VB6 I always get this error everytime I ran the program. Dim rs As New ADODB.Recordset rs.Open "Select * From tbluser Where uname = '" & txtuser.Text & "'", cnn, adOpenStatic, adLockReadOnly If rs.RecordCount < 1 Then MsgBox "Invalid Username!", vbCritical, "Login Error" txtuser.SetFocus Exit Sub Else If txtpass.Text = rs!pword Then Unload Me Load Form2 Form2.Show Exit Sub Else MsgBox "Invalid Password!", vbCritical, "Login Error" txtpass.SetFocus Exit Sub End If End If Set rs = Nothing MODULE CODE: Option Explicit Public cnn As ADODB.Connection Public Sub getconnected() Set cnn = New ADODB.Connection cnn.CursorLocation = adUseClient cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.