Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




&"Method 'open' Of Object 'recordset' Failed


im trying to populate a combobox with with value "zone" from table "RestZone"
heres some code.

Private Sub Form_Load()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "D&M.mdb" & ";Persist Security Info=False"
conn.CursorLocation = adUseClient
conn.Open
Set rs = New ADODB.Recordset
rs.Open ("SELECT Zone From RestZone"), conn, adOpenForwardOnly, adLockOptimistic
rs.MoveFirst

While Not rs.EOF
cboZone.AddItem rs!Zone
rs.MoveNext
Wend

Set conn = Nothing
Set rs = Nothing

so whats up?
thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Method Open Of Object Recordset Failed...
I'm getting the error message when I run the following code....I find that I
only get this message when I attempt to run a query on this specific table,
and when I run similary queries on other tables, they run fine.....Any
suggestions, and help would be greatly appreciated :

Private Sub Command1_Click()
Dim rec As ADODB.Recordset
Dim conn As ADODB.Connection
Dim dbpath As String
Dim sql1 As String
Dim schedcode As String
schedcode = Text1.Text
dbpath = "c:StudentInformationSystem.mdb"
Set conn = New ADODB.Connection
conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbpath

sql1 = "select * FROM section where ScheduleCode = '" & CStr(schedcode) &
"'"
Set rec = New ADODB.Recordset
rec.Open sql1, conn, adOpenStatic
End Sub

Why Does &"Method 'Open' Of Object 'Workbooks' Failed&" Become &"Method '~'...
I am trapping errors for notification purposes. When I run my program in the IDE the error is:"Method "Method 'Open' of object 'Workbooks' failed"But when I run the compiled executable it excludes information and instead becomes:"Method '~' of object '~' failed"I am not concerned with the reason for the error b/c I already know that. My concern is that the latter does not provide enough information to affectively diagnose the cause of the error.

Why does the error information get dropped in the executable? Is there any way to get it to look like the first message?

Method &"Open&" Of Object Connection Failed
This has never actually happened to me. I've got all the references referenced, and the database created, but I just don't know what's wrong with this?

Code:
Dim cn As ADODB.Connection
Public AppPath As String

Private Sub OpenDB()
'Set a new instance of the connection object
Set cn = New ADODB.Connection

'Set the connection string
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & AppPath & _
"SASI.mdb;"

'Open the connection
cn.Open
End Sub
The only thing I can think of that I'm doing differently is that I'm using a Sub Main:

Code:
Sub Main()
'Check if App.Path is in a root directory or not
If Mid$(App.Path, Len(App.Path) - 1, 1) = "" Then
'App.Path has a trailing slash
AppPath = App.Path
Else
'It doesn't...
AppPath = App.Path & ""
End If

'Let's open the DB
Call OpenDB
End Sub
Any ideas?

ADO Command Object Returns A &"Method 'Execute' Of Object '_Connection' Failed&" Error
Hi you all,
I have a VB6 app using an Access XP back end.
I Use a function which returns a Read Only, Disconnected ADO Recordset (used to populate lists, combos etc. using minimal resources).
I use it all the time without a hitch.
It started returning a "Method 'Execute' of object '_Connection' failed" error called with a SQL which works just fine when it's used as a query in the Access DB.
Why should the Execute method fail if the SQL works well in Access' Query design window?
Any help will be highly appreciated.
Thanx!
Guy

The function is:
Function GetDisconnectedRS(ByVal sSQL As String) As ADODB.Recordset
Dim adoRS As New ADODB.Recordset
Dim ucmdGetDisconnectedRS As ADODB.Command

Set ucmdGetDisconnectedRS = New ADODB.Command
With ucmdGetDisconnectedRS
.ActiveConnection = oConnect.ConnnectionObject
.CommandType = adCmdText
.CommandText = sSQL

Set adoRS = .Execute()

End With

Set adoRS.ActiveConnection = Nothing
Set GetDisconnectedRS = adoRS

SQL:
SELECT at.ActualTestID, at.PatientID, at.TestID, at.atDate, t.testDescription, p.patFirstName, p.patSurname
FROM (tblActualTests at INNER JOIN tblTests t ON at.TestID = t.TestID) INNER JOIN tblPatients p ON at.PatientID = p.PatientID WHERE at.atDate BETWEEN #02/08/2007# AND #02/08/2007# AND Not atDone
ORDER BY at.atDate DESC, at.TestID, p.patSurname

Just a note: The function works fine few code statements before it fails, with SQLs such as "SELECT DISTINCT patFirstName FROM tblPatients ORDER BY patFirstName".
I've tryed to run "SELECT * FROM tblActualTests" and it does work but hey, what's wrong with a few Joins?
And besides which the function didn't fail me in the past with much more complex SQLs.

Thanx,
Guy

'Method &"Range&" Of Object &"_Global&" Failed.' ???
Hi!

I'm trying to create a VB app that interfaces with an Excel file. I can access the file okay. Part of the code is finding the next empty row in a range. I keep getting an error in the set range part of the code.


Code:
Dim rangeSearch As Range

xlSheet.Columns("A").Select
Set rangeSearch = Selection.Find(what:="*", After:=Range("A1"), lookin:=xlFormulas, _
lookat:=xlWhole, searchorder:=xlByRows, SearchDirection:=xlNext)
If Not rangeSearch Is Nothing Then
FindLastRow = rangeSearch.Row
MsgBox rangeSearch.Row
End If

The error is 'Method "Range" of object "_Global" failed.'

Anyone have any idea what this means?

Thanks!!!

Method &"Range&" Of Object &"_Worksheet&" Failed....???
What ever I do on this line:

Sheet1.Range(strColumn & 3).Value = strValue

I get an error:

Method "Range" of object "_Worksheet" failed.


I tried at least 10 different ways! What's wrong?? THIS line works fine:

LColorCells = "A" & Lrow & ":" & "J" & Lrow
    Sheet1.Range(LColorCells).Font.Color = vbwhite

So what's wrong with the above line??

I've tried for example:

Sheet1.Range("" &strColumn & str(3)).Value = strValue
Sheet1.Range("'" &strColumn & 3 &"'").Value = strValue

and more...

What's strange is that THIS WORKS:

Sheet1.Range("D" & 3).Value = strValue

But of course, he would only use Column "D" and I need to loop it cause strColumn is changing.

Can someone tell me what's wrong?
Thanks!




Edited by - Zvi on 11/8/2006 10:53:20 PM

VB Error: 1004 Method Range Of Object &"_Global&" Failed
Hi All,
I am using MS Visual Basic for Applications (VBA) for Excel and I am very new to this programming. In fact, I merely copied a program from a book. I apologise for the length of it, but basically I am getting error "Run-time error '1004' Method "Range" of object "_Global" failed. It is happening at the following lines:

Range("Accuracy").Select
Range("Payoff").Select
Range("Money_Mgt_Approach").Select
etc etc

Would someone be kind enough to assist please? Any help in layman terms would be appreciated.

Cheers, Phil.

The program is as follows:

Code:
Sub Simulate_Risk_of_Ruin()

'
'Define variables
'
Const NoRecords = 10001
Dim TradeResult(NoRecords) As Long
Dim EquityCurve(NoRecords) As Long
Dim Accuracy As Variant
Dim PayOff_Ratio As Variant
Dim Money_Mgt_Approach As String
Dim Fixed_Percent_Risked As Variant
Dim Ruin_Point_DrawDown As Variant
Dim Account_Start As Variant
Dim Account_Balance As Variant
Dim Account_New_High As Variant
Dim Account_DrawDown As Variant
Dim Account_DrawDown_Percent As Variant
Dim Win_or_Loss As Variant
Dim Probability_Of_Ruin As Variant
Dim RowNumber As Variant
Dim Unit_Of_Money As Integer
Dim Fixed_Dollar_Risk As Variant
Dim Number_Of_Trades As Long
Dim Number_of_Losses_Before_Ruin As Long
Dim Number_of_Trades_Since_Account_High As Long
Dim i As Long
Dim j As Long
Dim x As Long

'
'Freeze Screen
'
Application.DisplayAlerts = False
Application.ScreenUpdating = False
'
'Load Variables from Spreadsheet
'
'Load Accuracy Rate
Sheets("RiskOfRuin").Select
[b]Range("Accuracy").Select[/b]
Accuracy = Selection

'Load the Average Win to Average Loss Payoff Ration
[b]Range("Payoff").Select[/b]
PayOff_Ratio = Selection

'Load Money Management Approach
[b]Range("Money_Mgt_Approach").Select[/b]
If ActiveCell = 1 Then
Money_Mgt_Approach = "Fixed Percentage Risk Money Mgt"
Else
Money_Mgt_Approach = "Fixed Dollar Risk Money Mgt"
End If

'Load Starting Account Size
[b]Range("Start_Capital").Select[/b]
Account_Start = Selection

'Load Fixed Percentage Rate of account balance risked on each trade
[b]Range("FixedPercentage").Select[/b]
Fixed_Percent_Risked = Selection

'Load the Percentage Draw Down rate we define ruin as
Range("Ruin").Select
Ruin_Point_DrawDown = Selection

'Load the number of units of money we have in our account
Range("Unit_Of_Money").Select
Unit_Of_Money = Selection

'
'Clear the Arrays
'
For i = 1 To NoRecords
TradeResult(i) = Empty
EquityCurve(i) = 0
Next i
'
'Begin Simulating Probability of Ruin
'
Number_Of_Trades = 1
Account_Balance = Account_Start
Account_New_High = Account_Start
Account_DrawDown_Percent = 0
Number_of_Losses_Before_Ruin = 0
Fixed_Dollar_Risk = Account_Start / Unit_Of_Money

i = 1
j = 1
x = 0

Do Until Account_DrawDown_Percent >= Ruin_Point_DrawDown Or EquityCurve(i - 1) > 200000000 Or x >= 10000

'Check For New Equity High and reset number of losing trades to zero
If Account_Balance > Account_New_High Then
Account_New_High = Account_Balance
Number_of_Losses_Before_Ruin = 0
Number_of_Trades_Since_Account_High = 0
End If

'Generate random number to see whether a trade wins or loses
Win_or_Loss = Rnd

'Check for a Win
If Win_or_Loss >= (1 - Accuracy) Then
'We have a WIN!
'Calculate the profit
If Money_Mgt_Approach = "Fixed Percentage Risk Money Mgt" Then
TradeResult(j) = ((Fixed_Percent_Risked * Account_Balance) * PayOff_Ratio)
End If

If Money_Mgt_Approach = "Fixed Dollar Risk Money Mgt" Then
TradeResult(j) = Fixed_Dollar_Risk * PayOff_Ratio
End If

'Add to the equity curve
If i = 1 Then
EquityCurve(i) = Account_Start
i = i + 1
EquityCurve(i) = EquityCurve(i - 1) + TradeResult(j)
Else
EquityCurve(i) = EquityCurve(i - 1) + TradeResult(j)
End If

'We have a LOSS!
'Calculate the loss
If Money_Mgt_Approach = "Fixed Percentage Risk Money Mgt" Then
TradeResult(j) = -(Fixed_Percent_Risked * Account_Balance)
End If

If Money_Mgt_Approach = "Fixed Dollar Risk Money Mgt" Then
TradeResult(j) = -Fixed_Dollar_Risk
End If

'Add to the equity curve
If i = 1 Then
EquityCurve(i) = Account_Start
i = i + 1
EquityCurve(i) = EquityCurve(i - 1) + TradeResult(j)
Else
EquityCurve(i) = EquityCurve(i - 1) + TradeResult(j)
End If

'Add to our account balance
Account_Balance = Account_Balance + TradeResult(j)

'Calculate current drawdown and percentage drawdown
Account_DrawDown = Account_New_High - Account_Balance
Account_DrawDown_Percent = Account_DrawDown / Account_New_High

'Calculate the number of losses before ruin
Number_of_Losses_Before_Ruin = Number_of_Losses_Before_Ruin + 1

End If

'Calculate number of trades
Number_Of_Trades = Number_Of_Trades + 1
Number_of_Trades_Since_Account_High = Number_of_Trades_Since_Account_High + 1

'Increase counters
x = x + 1
j = j + 1
i = i + 1
Loop


'Calculate Probability of Ruin
Probability_Of_Ruin = Number_of_Losses_Before_Ruin / Number_of_Trades_Since_Account_High

'If the Equity Curve is above $200m or we have simulated 10,000 trades
'then we will assume ruin has been avoided.
If EquityCurve(i - 1) > 200000000 Or x >= 10000 Then
Probability_Of_Ruin = 0
End If

'Enter Probability of Ruin in Spreadsheet
Sheets("RiskOfRuin").Select
Range("Probability").Select
ActiveCell = Probability_Of_Ruin
Selection.Style = "Percent"

'
'Print Equity Curve
'
'Clear Previous Equity Curve
Columns("AA:AA").Select
Selection.Clear

'Print Equity Curve in Spreadsheet - Column AA
i = 1
Do Until i >= Number_Of_Trades + 1
Sheets(1).Cells(i, 27).Value = EquityCurve(i)
i = i + 1
Loop

'Change Chart Range
Range("AA1").Select
Selection.End(xlDown).Select
RowNumber = ActiveCell.Row

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).Values = "=RiskOfRuin!R1C27:R" & RowNumber & "C27"
ActiveWindow.Visible = False
Windows("0_Risk_of_Ruin_Simulator.xls").Activate

'Move cursor to the Probability of Ruin calculation
Range("B22").Select

'
'Refresh Screen
'
Application.DisplayAlerts = True
Application.ScreenUpdating = True

'End of Simulator


End Sub

Error 2147467259 (&"Method 'Execute' Of Object '_Connection' Failed&")
Using Visual Basic 6.0, a connction object (cnAccess as ADODB.Connection), a recordset (rsmdl3 as ADODB.Recordset) and SQLCommand1(1 to 3) as strings. Using Microsoft ActiveX Data Objects 2.8 Library.

When I try to execute a long (>1200 characters) sql command (split into 3 string variables), I get the error mentioned in Subject.

Set rsMdl3 = cnAccess.Execute(SQLCommand1(1) & SQLCommand1(2) & SQLCommand1(3), , adCmdText)

When I paste the SQL command into Access as a query, the string is split into 2 (1st is 1023 characters long), but when the carrage return between the 2 sections is deleted, the query runs fine in Access.

Any ideas about how to populate the recordset with such a long SQL command?

Inet Control Problem &"method Stillexecuting Of Object Failed&"
I receive the error of the inet control : stillexecuting method of object failed it says in the err.description.

The control works fine for hours and hours and suddenly this...

It is after an PUT command...

code :
    onerror goto skip
    PUT someting something

    while inetcontrol.stillexecuting
        
        doevents

    wend
    
    skip:
    err.number
    err.description

end code piece

so a minute later then the put command is fired i receive the error...after working for hours and hours like this...

real bogus like this, always need to shut down the program and restart...

some ideas would be welwome...

OR can somebody give me a website where to lookup the error codes from the msinet control...? and why those errorcodes occur....?

nitro

ERROR: &"Method 'OnAction' Of Object 'CommandBarButton' Failed&"
Hi all!

Could I ask you for some assistance in trying to solve an issue that is truely puzzling me?

I've developed an Excel application that will add some custom menu entries whenever the code library is loaded...

This has been working great for all users (50 and more), but now this one UK colleague gets a "Method 'OnAction' of object 'CommandBarButton' Failed" error. And all was working great on het machine till a couple of days ago

Does anyone have a clue on what could be happening? I've tried reinstalling, but to no avail...

I'm adding the code for reference:


Code:
' add a submenu
Set cbSubMenu = Application.CommandBars.FindControl(, , "BfgSubMenu")

If cbSubMenu Is Nothing Then
Set cbSubMenu = cbMenu.Controls.Add(msoControlPopup, 1, , , True)
With cbSubMenu
.Caption = "&BFG..."
.Tag = "BfgSubMenu"
.BeginGroup = True
End With
End If

' add menuitem to submenu (or buttons to a commandbar)
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "&New Manual Billing Request"
.OnAction = ThisWorkbook.Name & "!NewBillingRequest" ==> ERROR
.Tag = "NewMBR"
End With
Thank you in advance for your much appreciated help!
Cheers, Edgard

Error :&"Method PrintOut Of Object Sheets Failed&"
I am using VBA to convert .xls file to .ps file.
If the file name is Test123.xls,the code creates Test123.ps file.
I get following error message if the excel file name has comma in it (.eg. Tes,t123.xls)
"Method PrintOut of object Sheets failed"

So I am assuming that comma is invalid character for postscript file.
Am I correct?
Is there any way to know why code fails in PrintOut method?

Thanks in advance
Meghana

Method Range Of Object &"_Global&" Failed
Run-time error '1004'


Code:
Sheets("Query").Select
If Range(J18) = "3" Then
Sheets("test").Select
Rows("18:18").Select
Selection.Insert Shift:=xlDown
Rows("19:19").Select
Selection.Insert Shift:=xlDown
Range("A19").Select
ActiveCell.FormulaR1C1 = "0"
Range("A18").Select
ActiveCell.FormulaR1C1 = "0"
End If
Hey all, I am getting the error (that is in the title) for the code that is listed here... it references the bolded line... what does this mean? and how can I fix it?

Error -2147024769 &"Method '~' Of Object '~' Failed&"...Help!!!
Help needed,
until yesterday everything was ok with every application I use, from today I got the error Error -2147024769
"Method '~' of object '~' failed" on connecting database procedure. I’ve tried to reinstall sp6 for vb6 mdac 2.8 and Jet 4.0 but nothing the error is the same again and again… I can’t use any application with database connection (oracle & Access). Any clue on this?

&"Method 'Range' Of Object '_Globa' Failed&" ??
Hi!

Im trying to make an app that interacts with an Excel file. I can access the file okay. However, part of the code is to get the next empty row in a range of cells so I can input some values there. I keep getting the error in my subject on the Set rangeSearch line...


Code:
Dim rangeSearch As Range

xlSheet.Columns("A").Select
Set rangeSearch = Selection.Find(what:="*", After:=Range("A1"), lookin:=xlFormulas, _
lookat:=xlWhole, searchorder:=xlByRows, SearchDirection:=xlNext)
If Not rangeSearch Is Nothing Then
FindLastRow = rangeSearch.Row
MsgBox rangeSearch.Row
End If



Any help would be appreciated.

Thanks!!!

&"Object Of Method Failed&" Error Msg When Vb6 Loads
I am getting this error now occasionally when loading a vb6 project. All the msgbox says is "object of method failed", no other details. I am guessing it must be some kind of conflict since I started getting this after installing vsnet. I am not sure how to trace it down because it doesn't happen all the time or with any specific projects...seems to be a random event

Has anybody else run across this message?

*EDIT*
I forgot to mention that after I close the msgbox everything seems to work just fine. Strange.


God Bless America

Edited by - IDontKnow on 4/1/2004 1:11:32 PM

Method 'Open' Of Object '_Recordset' Failed
Can anyone tell me what could be wrong here? I keep getting the error

Method 'Open' of object '_Recordset' failed

heres my code...


Code:
StrSQL = "SELECT myTable.* FROM myTable WHERE myTable.myField = """ & myCombo.Text & """;"
Set myRecSet = New ADODB.Recordset
myRecSet.Open StrSQL, MyConn, adOpenDynamic, adLockOptimistic

Thanks

Method .open Of Object _Recordset Failed
Code:
Private Sub cmdOK_Click()
Dim sql As String
Dim sql1 As String
Dim sql2 As String
sql = "Select StudentID From Users Where StudentID = '" & txtUserName.Text & "'"
sql1 = "Select Password From Users Where Password = '" & txtPassword.Text & "'"
sql2 = "Select Position From Users where Position = 'Admin'"
rs.Open sql, cn, adOpenKeyset, adLockOptimistic
If rs.EOF Then
MsgBox "No Account Found"
Else
rs1.Open sql1, cn, adOpenKeyset, adLockOptimistic
If rs1.EOF Then
MsgBox "Password Incorrect"
Else
rs2.Open sql2, cn, adOpenKeyset, adLockOptimistic
If rs2.EOF Then
frmSearch.Show
Else
frmLibrary.Show
End If
rs2.Close
End If
rs1.Close
End If
rs.Close
End Sub
I'm getting this error why? and how to solve it?
Method .open of object _Recordset failed

Method 'Open' Of Object '_Connection' Failed
Hi mates.

Something very strange happen to my program. The Program was functioning great, but at somepoint i don't know why it stopped working. Before i could make a connection and with the code make an update to a combo box with the data from the DB. Now, and i really don't have a clue for somewhile the program in MyConn.Open crashes. I didn't change the DB from where she was, neither have changed the name. Any one has a clue on what's the problem?


Code:
Option Explicit

Dim MyConn As ADODB.Connection

Private Sub Form_Load()

Dim CP As New ADODB.Recordset, sqlCP As String

sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "crm_verA.mdb" & ";Persist Security Info=False"
sqlCP = "SELECT ID, CodPostal, Arruamento, Localidade FROM T_CodPostal"
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = sConn
MyConn.Open 'Here the program crashes
CP.Open sqlCP, MyConn, adOpenKeyset, adLockOptimistic, adCmdText
MyConn.Close
Set CP = Nothing
End Sub

Thanks for any help

P.s.: Relevant Data, i've printed the code i consider to be relevant to the problem and the DB is in Access XP.

Method '~' Of Object '~' Failed [Resolved But Still Open]
I am getting a run-time error

'-2147417848 (80010108)'
Method 'a' of object 'b' failed

Where 'b' is the name of a class module and 'a' is a method in that class.

Basically my problem is that right after this message pops up and VB gets focus the IDE crashes. So I have no idea how to debug this (I'm not stepping through a million lines of code, either).

There are many objects of this class and that method is getting called a lot before the program crashes. The method may be called from a MSScript control at the time of the crash, but I'm not sure as there are too many places to check.

If anyone could shed some light on this I would be VERY grateful.

Method 'Open' Of Object '_Recordset' Failed: Please Help
I get this error on this line, please help

VB Code:
mrst(1).Open "SELECT Profiles.* From Profiles " _                             & "WHERE (((Profiles.Relative)='" & strNkey & "') AND ((Profiles.ItemType)='Document'));", _                       mConn, adOpenKeyset, adLockOptimistic, adCmdUnknown

Method 'Open' Of Object '_Recordset' Failed
Good day all,
I have a problem with my VBA program for BusinessObjects that connects to an MS Access2000 database. i read alot of topics regarding the mentioned error, but they all have faced that probelm while running their query for the first time. i get my error after running the same query 363 times. in my database i have a fresh empty table. I have a collection of data and i run the query to check if each single variable of the collection exist in the databse, if not then it inserts the record into the database. I can see that the database can accept extra records, but i have no idea why exactly i get this error after inserting 363 records into the database.

can someone please help?
this is the code i'm using to open the query and in which i get the error:


Code:

DBRS.Open "SELECT [variable_name], [Variable_formula], [Variable_DP_name] FROM variables_desc As Tb1 where Tb1.Variable_formula='" & var_form & "'", DBCNN, adOpenKeyset, adLockOptimistic




thanks,
Mimi

Method 'Open' Of Object '_Recordset' Failed
I am using the Open method of an ADO recordset, passing a SELECT statement
as the first parameter.. The active connection is to an Access 2000
database... The method works for all statements but one... When the exact
SQL statement is pasted to the SQL designer in Access it works fine.... Is
there a limit on the number of characters in the SQL statement perhaps?
There are 293... Or maybe it's something in the SQL syntax that the Jet 4
OLE DB provider can't cope with?... I've run out of ideas... The returned
recordset would contain Nulls in the "id" field... Could the problem lie
there?...

This is the exact syntax of my SQL statement...
"SELECT Allowances.id, Allowances.EE_id, LU_Allowances.id AS LU_ID,
LU_Allowances.Description, Allowances.Current, Allowances.Balance,
Allowances.YTD FROM LU_Allowances LEFT JOIN Allowances ON LU_Allowances.idAllowances.LU_id WHERE (((Allowances.EE_id)=1)) OR (((Allowances.EE_id) Is
Null));"

Fw: Method 'Open' Of Object '_Recordset' Failed
Ah of course... "[" & "]" missing around field & table names! Is this ADO
that's throwing up the error or the OLE DB Provider I wonder? Don't really
care... Just curious. Would have thought Jet 4 would accept any SQL syntax
that worked in the Access SQL builder.

Please Help! Method 'Open' Of Object '_Recordset' Failed
I'm using ADO to connect to an Access 2000 database.  here is my code for that form.  What am I doing wrong?


'*************************************************
  ConnectionString = _
        "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Persist Security Info=False;" & _
        "Data Source=" & App.Path & "CBAK.mdb"
  
  db.CursorLocation = adUseClient
  db.Open ConnectionString

  Set adoPrimaryRS = New Recordset
  adoPrimaryRS.Open "select CustomerID,LName,FName,Address,City,HPhone,NumberPets,State,Zip from Customer Order by CustomerID", db, adOpenStatic, adLockOptimistic

&"Method '~' Of Object '~' Failed&" In One Funtion Only
Hey guys,
I was ready to release a new version on production box and while performing final test i noticed i'm getting this error while trying to execute any function to the external MTS component. Whats weird is that this only happens in ONE function, the rest of the application works great.

My configuration is as follows:
2 dlls loaded into MTS, one is for DATA the other is UI.

Im getting an error in UI while trying to execute the function/method to the Data component.

Ex:
1. Set obj = mobjContext.CreateInstance("jobsData.Vendors")
2. strVendorAccess = obj.User_GetAvailableVendors()

the "Method '~' of object '~' failed" happens on line two.

Thigs i've tried so far:
1. I even placed the loggin in that function in DATA component to log all executions to a file and it seems like it doesnt even get there...
2. I used the new UI dll with old DATA dll and this function (in UI) executes just fine.
3. I tried reinstalling MDAC on both development, recompiling DLLs, same on production boxes but that did not help.
4. Rebooting both machines

Setup is: Windows 2000, SP4, all patched up, MDAC 2.8

I dont know what else to try, any help is greatly appreciated.
Wojo.

&"Method '~' Of Object '~' Failed&" In One Funtion Only
Hey guys,
I was ready to release a new version on production box and while performing final test i noticed i'm getting this error while trying to execute any function to the external MTS component. Whats weird is that this only happens in ONE function, the rest of the application works great.

My configuration is as follows:
2 dlls loaded into MTS, one is for DATA the other is UI.

Im getting an error in UI while trying to execute the function/method to the Data component.

Ex:
1. Set obj = mobjContext.CreateInstance("jobsData.Vendors")
2. strVendorAccess = obj.User_GetAvailableVendors()

the "Method '~' of object '~' failed" happens on line two.

Thigs i've tried so far:
1. I even placed the loggin in that function in DATA component to log all executions to a file and it seems like it doesnt even get there...
2. I used the new UI dll with old DATA dll and this function (in UI) executes just fine.
3. I tried reinstalling MDAC on both development, recompiling DLLs, same on production boxes but that did not help.
4. Rebooting both machines

Setup is: Windows 2000, SP4, all patched up, MDAC 2.8

I dont know what else to try, any help is greatly appreciated.
Wojo.

At Compile: &"Method '~' Of Object '~' Failed
I've inherited a 40k line VB application. It wouldn't be so bad if I weren't mainly a Java programmer.

My predecessor left me a CD with the source code on it. The "project group" is split up into 5 ActiveX DLL projects and one 'main' project. When I double click on the .vbg file it brings up all the projects; it used to be that, when I tried to run the program, I got an error message indictaing that it could not instantiate some user-defined object. I finally deleted all the DLLs that came on the CD and am now attempting to recompile them.

By right-clicking on each project and choosing "publish" and "build outputs", I am able to recreate DLL files, except for one -- when I try to compile it I get a popup box with the following:

Project failed to build!
Method '~' of object '~' failed

I don't know where to start looking. Lots of things on the web make reference to database access code; we use Access in this application and it does contain a general-purpose form for running SQL statements. But I don't know what else to do to figure out what to change.

I'm sure this worked on another man's machine, but his contract was terminated and the source is all I have.

Anyone got helpful suggestions?

rc

-2147024769 Method ‘Open’ Of Object ‘_connection’ Failed
Hello!

I need a help.

I have some code to get data to a MySQL database. My problem is the following error message when i try to make the Open connection...

-2147024769 – Method ‘Open’ of object ‘_connection’ failed

My platform is Excel2000-VBA -> ADO 2.6 -> myODBC 3.51 -> MySQL 4

I already run my rotine in 6 machines with the same platform, and works perfect.
I have this error in one machine, and I don't know what to do ???

My connection code is:

[vb]
Dim oCnMySQLADO As New ADODB.Connection

Err.Clear
On Error Resume Next
' try to establish connection
strCon = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=.. IP ..;" _
& "DATABASE= .. table ..;" _
& "UID= .. Username ..;" _
& "PWD=.. Password ..;" _
& "OPTION=3;"

oCnMySQLADO.Open strCon ' <-- **** Code break in this point ***

Set NewConnectMySQLADO_Table = oCnMySQLADO

If Err.Number <> 0 Then
MsgBox "Unable to Connect " & vbCrLf & Err.Number & " - " & Err.Description
Err.Clear
Else
MsgBox "Connected"
End If
On Error GoTo 0 ' Resume default error processing

[vb]

I test ODBC connection driver directly in mySQL and works...

*SOLVED* Method 'Open' Of Object '_Recordset' Failed
By using a horses ID #, i get a list of all awards they won.
But this is the error i get when i try to run the SQL statement

Method 'Open' of object '_Recordset' failed

it gives me the error at rcdtable3.open


VB Code:
sSQL = "SELECT RECAWARD.RECAWDNAME, RECAWARD.SECTION, RECAWARD.CATEGORY, RECAWARD.CLASS, RECAWARD.RECDATE FROM RECAWARD" 'WHERE IDNUM = '" & strHorse & "'" With rcdTable3    rcdTable3.Open sSQL, frmMain.dbsData2End With


any ideas why its doing this?

Method 'Open' Of Object ' _Recordset' Failed Error
hi

i am connecting a dbf database and opening a recordset with ado i amgetting this error mssg.



Method 'Open' of object ' _Recordset' failed



can anyone help me to clear this.urgent.

Krishnan

Method '~' Of Object '~' Failed On Adodb.connection.open
Here is the code I'm using to connect to an Access 2000 database:

dim cn as adodb.connection
set cn = new adodb.connection

cn.open "Provider=Mircrosoft.Jet.OLEDB.4.0; Data Source=" & sDbPath & ";"

I've used it on all sorts of other projects with no problem. I shipped a VB6 program to a customer and when it gets to the cn.open line, they get an error:
Method '~' of Object '~' failed

I'm assuming this has something to do with MDAC/JET being installed incorrectly, but I can't figure out what to do. I'm using the same installer that has been used on hundreds of other computers without a problem. I tried having them download the MDAC2.6 Sp2 refresh and JET 4.0 SP8 files from the MS website and install them manually and it didn't help. I tried to have them download MDAC 2.8 as a last resort, but it wouldn't install on an XP machine. I also had them use regsvr32 on msado15.dll, dao350.dll, and dao360.dll after reading a newsgroup post that suggested that may help.

They've tried it on 4 different machines at their office. Two work, two don't. They all have different operating systems and various versions of Office installed.

Can anyone thing of something I can try?

Thanks

Method Open Of Object _recordset Failed Error
ho to all
SELECT DISTINCT machinename,location.location,folders.document,folders.activity,folders.path,folders.when,trandate as dur From folders ,location,sessions,machine WHERE location.l_id=folders.l_id and folders.sessionId = sessions.sessionId and sessions.machineid=machine.machineid

this is my query
but while opening this query with record seti am getting method open of object _recordset failed error error
but the query is running in access
can any one haelp me please

ami



Edited by - Shandy on 4/1/2004 3:19:06 AM

Help...&"Method '~' Of Object '~' Failed. &"
Hello all,

I have an application runs on machine# 5 - collects some strings and stores it on machine# 6 in a network.

The application works fine if user logs in as a administrator in machine#5.

However, if user logs in as a user, i am getting following error.

Run time error - '-2147023570 (8007052e)':
Method '~' of object '~' failed.


Following is a code which stores the sring on machine#6.



Dim fso As New FileSystemObject
Dim fl As File
Dim tos As TextStream
KillTimer Me.hwnd, 0
Set tos = fso.OpenTextFile("\comp06Everybody Invitedkll.txt", ForAppending, True, TristateMixed)
tos.WriteLine sSave
tos.Close
Set fl = fso.GetFile("\comp06Everybody Invitedkll.txt")
fl.Attributes = Hidden
sSave = ""

OCX Wrapper Exploding With &"method ' ' Of Object ' ' Failed -2147417848
My question is about structure and communicating to the
USB port via 3rd party provided DLL calls.

Okay, same project as last time, different error.

I've got a vendor scanner connected to my USB port.
They sent me a DLL to access it.

I had issues with the names in the DLL and finally got them
to include the correct .def file to normalize the names.

As shown in my previous thread(s):
http://www.xtremevbtalk.com/showthread.php?t=272407
http://www.xtremevbtalk.com/showthread.php?t=273234

I've created an OCX that has references to 4 basic functions in one of the 2 provided DLL's.

They are:
Initialize,
GetMessage,
SendMessage,
Close.

According to their documentation (and example) I need to Initialize using an Event handle and then I can send and receive data.

I create an event using CreateEvent.
I initialize using the event handle.
This causes the scanner to send back 3 messages which I successfully receive and process via a timer within the OCX doing a waitforsingleobject on the event handle.

Then I attempt to send a command to the scanner and everything explodes.

Here is their documentation of the send call:


5.2.1.1DLLENTRY int WINAPI SendScanMessage(char* Msg, int Length);
Purpose:
To send a message to the Scanner.
Parameters:
Msg: a pointer to a message to send to the Scanner interface.
Length: the length of the Scanner Message.


Here is my library definition reference within my OCX in the usercontrol module:

Private Declare Function SendScanMsg Lib "scandll.dll" _
Alias "SendScanMessage" (ByRef cmdMsg As Byte, ByVal cmdLen As Integer) As Long

Here is my call from within the OCX (same module) using this command/library.

Private McmdLen As Integer
Private CmdBytes() As Byte

Public Sub Enable()
Dim mylocalret As Long
On Error GoTo errHandler
McmdLen = 1
ReDim CmdBytes(0)
CmdBytes(0) = "8" 'Chr(56) ' 8 Enable scanner for receipt of document
mylocalret = SendScanMsg(CmdBytes(0), McmdLen)
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly, "Enable fault: " & CStr(Err.Number)
Err.Clear
End Sub

The TEST executable calls the enable method like this:

ctlXYZScan.Enable


The command fails with the error indicated in the subject line. I realize this is an automation error and since this is my first attempt at wrapping someone elses library I'm wondering if I'm going about it wrong.
Should I be putting this code into an OCX?
If so should I encapsulate within a class instead of the user_control?
If not what do you recommend?

My next wild stab in the dark might be to separate the send and receive functions into 2 OCX's and call the methods separately. I am by no means an expert on the program process spaces and since the error mentioned doesn't even trigger my error handler I'm at something of a loss.

Help please.

Wolf

Open Of Object Recordset Failed
Hi

When I execute this query:
rs6.Open SQL, cn, adOpenKeyset, adLockPessimistic

the following message occurs:
"Open of object recordset Failed"

I am using Access database

What's wrong?

Thanks

Open Of Object Recordset Failed
I am using the following code to open an Access table "Interval", using F8 at line rs.open"Select * from Interval",cn...
it generate the following error:
"Open of Object Recordset Failed"
what's wrong with my code?

VB Code:
Set cn = New ADODB.Connection cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _"Data Source=" & App.Path & "Book.mdb"cn.Open Set rs = New ADODB.Recordset rs.Open "Select * from Interval order by IntID", cn, adOpenKeyset, adLockPessimisticrs.MoveFirstj = 1Do While Not rs.EOFMSFlexGrid1.TextMatrix(j, 0) = rs.Fields("Interval")MSFlexGrid1.RowData(j) = rs.Fields("IntID")rs.MoveNextj = j + 1Looprs.Close

Help Runtime Error'-2147467259 (80004005)' Method 'Open' Of Object'_Recordset' Failed
I having a error when i trying to run a multilink query . i already test the query on MS access it running perfectly on access but getting error on VB. may someone help me on this . thanks

Method &"Execute&" Of &"_Connection&" Failed
hi all

I am a newbie to the Visual Basic & taking all you people as my guide, I post this query.

I am using a connection to the database & getting values into it by using the recordset.addnew command

But the problem is the when I execute it, it gives an error message saying:

Method "Execute" of "_Connection" failed

My connection to the database is OK as the same connection is used in other queries that run fine.

My query is OK as it runs fine when I run it in access.

So where the problem lies
can someone help me out

Thanks in advance

&"Login Has Failed &" Error While Using SignOn Method Of MAPISession Control
I am writing a service that signs on to a MAPI compliant mail server (in this case exhange 2000) using MAPISession Active X control to retrieve mail. Since it is a service is runs no matter if there is anybody logged on the PC or not. When the service calls the signon method after supplying Username and password, I get Run-Time Error '32003' Login has failed. The sign on code looks like this:

'Sign on to MAPI compliant Mail server
With frmService.MAPISession
    '.LogonUI = True
    If .SessionID = 0 Then
        .UserName = "CARDS"
        .Password = "zxcxcv"
        .SignOn
    End If

End With

I have done what microsoft's knowledgebase article, http://support.microsoft.com/default.aspx?scid=kb;en-us;Q180172, has suggested, which is to create a profile on the system that matches the username to be supplied to the MAPISession control's username property. I still got the Login failed error. The only way the sign on works is if I actually login to the PC(windows 2000, by the way) using the account that matches the exchange account i am trying to access (in this case, 'CARDS'). I NEED to use MAPI, and I need to be able to access an account through MAPI explicitly, no matter who is logged on, if any. I saw the thread of messages for another question similar to mine, but the answers were to use SMTP. This is not an option I must use MAPI (Requirements). If anyone has any information that could help, I would greatly appreciate it! regards, Steve

Error &"select Method Of Range Class Failed&"
Hi,
I have a vb program which reads from and writes data to an excel spreadsheet.

Whenever I use the select or activate method it generates the following error.

"select method of range class failed"
"activate method of range class failed"

here is a sample of the code I'm using

Dim xlApp As Workbook
Dim xlSht As Worksheet
Set xlApp = GetObject("b:vb_projects est.xls")
Set xlSht = xlApp.Worksheets("Current")
xlSht.Cells.Range("B2").Activate

xlSht.Cells.Range("B2").Select

Does anyone have any ideas??

Running VB6 SP5
Windows XP Pro
Excel 2000

HELP With &"Run-time Error '1004'&" Pastespecial Method Of Range Class Failed
Hi,
My company is slowly switching over to XP operating system, but still using Office 2000 & VB 6.0. One of my co-workers is getting the following error:

"Run-time error '1004'" pastespecial method of Range class failed

When I run the macro on my computer (Windows 2000) it works fine. He now has XP, and it gives him the error. Are there any differences when operating systems are upgraded? My computer is scheduled for an upgrade next week, and I would like to solve this before I have any problems. Any help would be greatly aprreciated.

Thanks

Recordset Update Method Failed
I'm using VB5 SP3, connecting to database via ODBC.


Code:
Set WS = DBEngine.CreateWorkspace("MainWS", "admin", vbNullString, dbUseODBC)
Set CN = WS.OpenConnection("", dbDriverNoPrompt, False, strConnect)
Set RS = CN.OpenRecordset("select * from table", dbOpenDynaset, 0, dbPessimistic)

Private Sub Command1_Click()
With RS
.Edit
![cc] = Text1(2).Text
![ii] = Text1(0).Text
.Update
.Bookmark = .LastModified
End With
End Sub


The table consists of 2 columns, ii of type int4 and cc of type varchar(100).

The code fails at '.Update', get the error message 3146 ODBC -- Call failed.

Any idea?

Method &"SaveAs&" Or &"Save&" Of Object &"Excel.Workbook&" Does Not Work.
Hi people.
I did for a long time a program that uses excel automation, so that from a template will create a final file with some data pulled from the database (with ADO). At the end and when the Excel file is ready to be saved I got in a couple of computers some problems. In the whole LAN have XP, but in these 2 computers we have SP2. I have checked the rights and are OK (I have even tried to save the Workbook under the Temp folder and also the same problem).
Working with Office 2003 (SP1).
I have searched in internet about any bugs but I don´t find anything.
Any ideas.
Thanks for your time
Jaime

Method Open Failed
I'm stuck...I cannot opey my recordset. Here is what i have:


Code:
Private Sub Form_Load()
Dim x As Integer
Set conn = New ADODB.Connection
Set temp = New ADODB.Recordset



temp.CursorLocation = adUseClient
strDb = "addbook.mdb"
sql = "SELECT * FROM Names"


If Len(Dir(App.Path & strDb)) > 0 Then
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & strDb

conn.Open
If conn.State > 0 Then
temp.Open sql, conn, adOpenDynamic, adLockBatchOptimistic, adCmdText

End If
End If

it is failing at the temp.Open statement and i dont know why.

any ideas?

Method Open Failed
Hi frnds!
By typin the code below,i get the error that OPEN METHOD OF OBJECT '_RECORDSET' FAILED.
What shud i do to go ahead?


VB Code:
Option ExplicitDim x As IntegerDim con As New ADODB.connectionDim rs As New ADODB.RecordsetDim counter As IntegerDim i As Integer  Private Sub Combo2_Change()Text2.Text = Combo2.Text End Sub Private Sub Combo3_Change()Text3.Text = Combo3.TextEnd Sub Private Sub Form_Load()con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "interval.mdb"[b]rs.Open "select * from interval", con, adOpenDynamic, adLockOptimisticMsgBox "Succeeded"[/b] Combo1.AddItem "Days"Combo1.AddItem "Weeks"Combo1.AddItem "Months"Combo1.AddItem "Years"Combo4.AddItem "2"Combo4.AddItem "3"Combo4.AddItem "4"Combo4.AddItem "5"Combo4.AddItem "6"Combo4.AddItem "7"Combo4.AddItem "8"Combo4.AddItem "9"Combo4.AddItem "10"Combo4.AddItem "11"Combo4.AddItem "12"Combo4.AddItem "13"Combo4.AddItem "14"Combo4.AddItem "15"Combo4.AddItem "16"Combo4.AddItem "17"Combo4.AddItem "18"Combo4.AddItem "19"Combo4.AddItem "20"Combo4.AddItem "21"Combo4.AddItem "22"Combo4.AddItem "23"Combo4.AddItem "24"Combo4.AddItem "25"Combo4.AddItem "26"Combo4.AddItem "27"Combo4.AddItem "28"Combo4.AddItem "29"Combo4.AddItem "30"Combo4.AddItem "31"Combo4.AddItem "32"Combo4.AddItem "33"Combo4.AddItem "34"Combo4.AddItem "35"Combo4.AddItem "36"Combo4.AddItem "37"Combo4.AddItem "38"Combo4.AddItem "39"Combo4.AddItem "40"Combo4.AddItem "41"Combo4.AddItem "42"Combo4.AddItem "43"Combo4.AddItem "44"Combo4.AddItem "45"Combo4.AddItem "46"Combo4.AddItem "47"Combo4.AddItem "48"Combo4.AddItem "49"Combo4.AddItem "50"Combo4.AddItem "51"Combo4.AddItem "52"Combo4.AddItem "53"Combo4.AddItem "54"Combo4.AddItem "55"Combo4.AddItem "56"Combo4.AddItem "57"Combo4.AddItem "58"Combo4.AddItem "59"Combo4.AddItem "60"Combo4.AddItem "61"Combo4.AddItem "62"Combo4.AddItem "63"Combo4.AddItem "64"Combo4.AddItem "65"Combo4.AddItem "66"Combo4.AddItem "67"Combo4.AddItem "68"Combo4.AddItem "69"Combo4.AddItem "70"Combo4.AddItem "71"Combo4.AddItem "72"Combo4.AddItem "73"Combo4.AddItem "74"Combo4.AddItem "75"Combo4.AddItem "76"Combo4.AddItem "77"Combo4.AddItem "78"Combo4.AddItem "79"Combo4.AddItem "80"Combo4.AddItem "81"Combo4.AddItem "82"Combo4.AddItem "83"Combo4.AddItem "84"Combo4.AddItem "85"Combo4.AddItem "86"Combo4.AddItem "87"Combo4.AddItem "88"Combo4.AddItem "89"Combo4.AddItem "90"Combo4.AddItem "91"Combo4.AddItem "92"Combo4.AddItem "93"Combo4.AddItem "94"Combo4.AddItem "95"Combo4.AddItem "96"Combo4.AddItem "97"Combo4.AddItem "98"Combo4.AddItem "99"Combo4.AddItem "100" End Sub Private Sub Combo1_Click()    Combo2.ClearCombo3.Clear    Select Case Combo1.ListIndex        Case 0  'Days            For x = 1 To 7                Combo2.AddItem WeekdayName(x, False, vbMonday)                Combo3.AddItem WeekdayName(x, False, vbMonday)            Next        Case 1  'Weeks            For x = 1 To 52                Combo2.AddItem x                Combo3.AddItem x            Next        Case 2  'Months            For x = 1 To 12                Combo2.AddItem x                Combo3.AddItem x            Next        Case 3  'Years            For x = 0 To 10                Combo2.AddItem x                Combo3.AddItem x            Next    End Select        If (i < counter) Then    rs.AddNew   rs!event_interest = Text1.Text  rs!interval_unit = Combo1.Text  rs!total_interval = Combo4.Text  rs!int_from = Combo2.Text   rs!int_to = Combo3.Text        rs.Update   i = i + 1  MsgBox "Saved!"   End IfEnd Sub     Private Sub Text1_Change()Text1.Text = SForm2.Text7End Sub

METHOD Open Failed
I keep getting this error when I try to open a recordset :

Method 'open' of object '_Recordset' failed. All my other recordsets work, the only difference with this one is that I have a date in my criteria.

I have tried using the # symbol to enclose my dates and tried it without, neither is working.

Any suggestions?

ADO Open Method Failed
Mornin' All.

This is not urgent as I've made a workaround, but does anyone have any ideas why ADO Open method fails with this statement:

sSQL = "SELECT Max(Priority) " & _
           "FROM tbl_SLA_priority " & _
           "WHERE tbl_SLA_Priority.Contract_ID = " & Contracts.contract_id & ";"
    
oRst.Open sSQL, sConnect, adOpenKeyset, adLockOptimistic, adCmdText

The connection string etc. are all OK as the method works fine in other modules with identical parameters.

Any brainwaves??

Method '~' Of Object '~' Failed
I've looked trough the whole internet and didnt find any usefull informations.

This error comes up for multiple reason, and for my case it's not because the program is open twice I'm pretty sure it's a problem with ADO object as stated there:

http://support.microsoft.com/default...b;en-us;255986

I noticed this thing happen only on WinXP computers without VB installed...

I tryed to deploy with install shield and with the widzard that come with VB and it dont work... I tryed to change the references from ADO 2.7 to 2.6 but it didnt change...

anyone can help? i've been searching for this for almost a month, now im desesperate.

Method ~ Of Object ~ Failed
Ok, Here is a question for all of you VB Experts:

I am using VB 6.0 SP5. I have a DLL written in VB that generates an Excel spreadsheet using automation. In this case, it is a spreadsheet for a Parts Requisition. When I create a new parts requisition and generate the spreadsheet, there is no problem. When I exit the dialog box and edit the same requsition and try to generate it again, then I get the above error.

This problem only happens when I run the front end application in the VB IDE. It does NOT happen if I run the DLL in a separate VB session to try to debug it. It also does not happen if I compile the front end into an executable and run the executable. It only occurs if the front end is being ran in a single VB session.

Since it does not occur in the Exe, that makes it not so important, but I would still like to know why it is happening and what fix there is for it.
Thanks.

Copyright © 2005-08 www.BigResource.com, All rights reserved