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

&"Failed To Activate Control 'VB.UserControl'&" Error

ok, i know i was the one that messed it up in the first place, but now i have to get rid of it.

in the previous builds of my application, the ocx components that i wrote for it were set for 'project compatibility'. i made some builds and did some installations, uninstallations and reinstallations on a couple of machines, and it was ok. somewhere along the lines, i switched the ocx projects to binary compatibility. i uninstalled again the former version and installed the new one. surprise... when the application starts, i get this error message:


Failed to activate control 'VB.UserControl'. This control is incompatible with your application. Make sure you are using the version of the control that was provided with your application.

(and of course, the nice microsoft single OK button, that forces me to accept that things are OK.) however, the same package installs properely on machines that have a fresh OS installed, and even on machines that had installed builds of my application later than the build where i switched the compatibility type.

i assume that an old version of one of my ocx'es could not be uninstalled properely, and it's sitting somewhere claiming that it has a higher version number than the one i try to overwrite it with, but i dont know where this information is stored, how safe would it be to manually remove it, and which is the ocx that has this problem. can anybody help pls. thanks.

(of course, one of the machines that i had one of the incipient installs is my boss' computer, so you have to understnd that this MUST work and HAS to be fixed FAST )

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
&"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"
    End If

End With

I have done what microsoft's knowledgebase article,;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

"Failed To Load Control" Error Msg
Hi All,

I write a standard EXE and an ActiveX DLL using VB6.0. on a W2K system. I
save the .Exe and .Dll to a diskette, walk to the W2K Server that the pgm is
to run on and copy both to a directory ( c:DlyCopy ) of their own on the
W2K Server.

When I run my .Exe, I get the following msg:
"Failed to load control 'common dialog' from COMDLG32.OCX. Your version
of COMDLG32.OCX may be outdated."

My developement w2k system shows COMDLG32.OCX in windowssystem32 ( date
5/22/2000 )and winntsystem32 ( date 6/24/1998 ).

The production w2k server shows COMDLG32.OCX only in winntsystem32 ( date
7/19/97 )

Copying the OCX to the directory c:DlyCopy with its friends the .Exe and
.DLL I wrote does not help. Same error msg.

My question: How do I get my .Exe to run on the w2k server system ?

I dont want to replace any of the OCXs that are on the w2k server system.
Any .OCXs should be copied to the same directory ( c:DlyCopy ) as the .Exe
and .Dll .

As I type I am looking at the "distributing your application" chapter of the
vb pgmr's guide. Any tips on creating a setup.1st file ??


Steve Richter

Failed To Activate Control 'VB.UserControl'
Failed to activate control 'VB.UserControl'. This control may be incompitable with your application. Make sure you are using the version of the control that was provided with your application.

My tester gets this when he tries my program on his sytem, can anyone dumb it down a bit so i can understand how to fix it?

Failed To Activate Control 'VB.UserControl'. (not Resolved By Fixed With Other Thing)
Failed to activate control 'VB.UserControl'. This control may be incompatible with your application. Make sure you are using the version of the control that was provided with your application.

ok i send my app to a mate and the first time the app worked perfectly... then when i did loads of updates i send him a new one. and he got this error both the EXe file and the OCX where recompiled and work perfectly here did i forget to do something else with the .ocx file or something? like reregister it (is that needed on a new version) or should i change the version number to a newer version everytime? :S

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:

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:

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
Accuracy = Selection

'Load the Average Win to Average Loss Payoff Ration
PayOff_Ratio = Selection

'Load Money Management Approach
If ActiveCell = 1 Then
Money_Mgt_Approach = "Fixed Percentage Risk Money Mgt"
Money_Mgt_Approach = "Fixed Dollar Risk Money Mgt"
End If

'Load Starting Account Size
Account_Start = Selection

'Load Fixed Percentage Rate of account balance risked on each trade
Fixed_Percent_Risked = Selection

'Load the Percentage Draw Down rate we define ruin as
Ruin_Point_DrawDown = Selection

'Load the number of units of money we have in our account
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)
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)
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

'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
ActiveCell = Probability_Of_Ruin
Selection.Style = "Percent"

'Print Equity Curve
'Clear Previous Equity Curve

'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

'Change Chart Range
RowNumber = ActiveCell.Row

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

'Move cursor to the Probability of Ruin calculation

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

'End of Simulator

End Sub

Visual Data Manager - Error "server Execution Failed"
Hello VB specialists,

Trying to use the option "Visual Data Manager" from the Add-in menu Iget the following message:
"System Error &H80080005 [-2146959355] server execution error.

Since I am not able to use the search of the MS website, because I getscript errors, I would like to ask your help in order to solve the abovementioned problem.

It would of course be great if someone can solve the script errors aswell.



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


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....?


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:

' 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 &"select Method Of Range Class Failed&"
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")


Does anyone have any ideas??

Running VB6 SP5
Windows XP Pro
Excel 2000

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 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

HELP With &"Run-time Error '1004'&" Pastespecial Method Of Range Class Failed
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.


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. Ive tried to reinstall sp6 for vb6 mdac 2.8 and Jet 4.0 but nothing the error is the same again and again I cant use any application with database connection (oracle & Access). Any clue on this?

What The H*ll Is &"Error 3146: ODBC Call Failed&"?
i'm connected to a valid system DSN, i have the correct username and password, and yet i still get that error.

halp, anybody. i beg of you good samaritans.

XMLHTTPRequest ERROR: &"The Download Of The Specified Resource Has Failed&"
I am trying to to submit an XML request object and subsequently receive an XML response object but cannot proceed past the "http.send reqDoc" command.

I receive two different errors messages when attempting to submit the XML object. The first message is produced on the following line of code:
http.send reqDoc
My system hangs for about 2 minutes on this line and then produces the following message:
Run-time error '-2146697208 (800c0008)':
The download of the specified resource has failed.
After I receive this message the application fails and I have to restart the application. After restarting the application the "http.send reqDoc" line executes but the http object indicates that the response XML object has not been received. It is at this point that I receive the second message which is:

Input Segments are Invalid

I am believe that the "Input Segments are Invalid" message is on account of the XML string not being formatted properly, however, I am unsure why I only receive this message after I stop and restart the application.

I would really appreciate insight into the the first message as I beleive it this issue that is causing the second issue.

The VB code is as follows:

PHP Code:

Private Sub BtnSubmit_Click()

' Build XML Object
    ' Create an empty DOM document
    Dim reqDoc As MSXML2.DOMDocument40
    Set reqDoc = CreateObject("Msxml2.DOMDocument.4.0")
' Post XML Object To Equifax
    ' Submit the request to the server
    Dim a As Boolean
    Dim http As MSXML2.XMLHTTP40
    Set http = CreateObject("Msxml2.XMLHTTP.4.0") "POST", "", False
    reqDoc.Load ("C:customerdata1.xml")
    http.send reqDoc  

End Sub 

&"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?

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

&"Failed To Load Control&"-Insatllation Problem
The problem is that i have developed an activex Control in vb and also used in my application.During development i was also upgraded my control and used new one.but when i make setup for distribution this control is working fine in my development as well as other machine in which VB is installed but in other machine it shows error message "Run time error 372-failed to load control" what exactly the problem pls. help.


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

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.

Dim rangeSearch As Range

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?


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?

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

Solution> Error: &"&"&"&"&H8007007E (-2147024770) The Specified Module Cannot Be Found&"&"&"

This is the error what i am getting after installing a package of one of my module on user testing machine.
The same module being working fine on others.

What can be the reason for this and what can be the probable solution for this?


&"Authentication Failed&" Error Trapping
In a project I'm working on, in my Sub Main process, I do a check for a Jet provider. I get the following error: -2147217843 ' "Authentification Failed" .

I've tried all "standard" error traps for this error, but so far, no luck. I've tried "on error goto errorroutine", "on error goto 0" and so on, but nothing catches the error.

How can I catch this error so that I can deal with it properly?

Any help is greatly welcome!!!!

Error: &"Failed To Retrieve Function ID For B!&".

I have made a multi thread program in VB that is running on a server. I am working as a third party developer and I am using components from an Application Framework that are meant for developing.

A client program from the provider is running on the clients, and a server version is running on the server.
When the user do something on the client, the client call the server and the server start my multi thread program.

It seems to work fine, but sometimes the program crash and I got this error in the Error Log: "Failed to retrieve function ID for b!".

Have anyone seen this error before?

I hope that someone can help me:)


Sorry for my bad English..

Jørn Arild Andenæs

ADO &"Driver's SQLSetConnectAttr Failed&" Error
Greetings to the VB community,

I've just installed the Informix Client SDK driver to connect to a database running on an AIX box. My machine is WinXP. The problem I am experiencing is that the DSN connection that I established gave a 'good' test connection during the configuration but my VB6 app dies when I try to use it. I have successfully used ADO to connect to other databases without any issues.

Just for information for any one that may have experience with this:

I have MS ActiveX Data Object 2.1 library installed

My connection string looks like:
adoConnection.ConnectionString = "DSN=PeopleSoft;UID=msddba;PWD=msddba"

I trapped the ADO Errors to get the following feedback:

Error #1
 ADO Error #-2147467259
 Description [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
 Source Microsoft OLE DB Provider for ODBC Drivers

Error #2
 ADO Error #-2147467259
 Description [Informix][Informix ODBC Driver]Unable to load translation DLL.
 Source Microsoft OLE DB Provider for ODBC Drivers

The name of the driver that I am using is ICLIT09BW.DLL. Is it possible that I am using the incorrect driver for the environment that I am in? Any help anyone can offer would be greatly appreciated.

&"Driver's SQLSetConnectAttr Failed&" Error
I am trying to write a simple asp program to get some data out of
a data file. I am not having any difficulty finding examples of
such asp code, but I am having a lot of difficulty getting the
database open. It seems like it might be some sort of a protection

I put the database file in a directory that is "wide open", all
privileges granted to "Everyone"

I created an ODBC System Data Source pointing to the .dba file,
using the Microsoft Access driver.

Notice that the error occurs on my attempt to open the database,
I never even get to the point of trying to open a recordset.

This is my .asp file:


<TITLE>Database Test</TITLE>
<% 'Option Explicit
dim Connect, Students, AnError, XError
Set Connect = Server.CreateObject("ADODB.Connection")
%> Error 1 = <% = Connect.Errors.Count%> <br> <%
for each AnError in Connect.Errors
%> Error Description = <%=AnError%> <%
Connect.Open "dsn=DHSGrades"
%> Error 2 ( = <% = Connect.Errors.Count%> <br> <%
for each XError in Connect.Errors
%> Error Description = <%=XError%> <%
Set Students = Server.CreateObject("ADODB.Recordset")
<br> 'Seems to always fail on attempt to open the dsn
<br> reset protection

This is the output from running the .asp page:


Error 1 = 0
Error 2 ( = 1
Error Description = [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
'Seems to always fail on attempt to open the dsn
reset protection

Set DataSource On Usercontrol Returns Error &"Method Or Data Member Not Found&"
Having a problem with custom usercontrol I created.

Binding is accomplished through Tools-->Procedure Attributes. All works well when DataSource and DataField set at design-time, but I cannot assign DataSource on my control in run-time (w/code). Error received = "Method or Data Member not found." - Please Help -


Set FCTitle.DataSource = DE
'--On error, ".DataSource" portion is highlighted.
FCTitle.DataMember = "Members"
FCTitle.DataField = "TitleID"

DE is DataEnvironment. Same error with DE, adodc, and my custom datasource. FCTitle is my data consuming usercontrol. I would be *SO* greatful to have this issue resolved.

- nlleach

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

Why &"Control&" Is An Error In &"For Each Control In Form1.Controls&"?
For Each Control In Form1.Controls
Control.Top = Control.Top + 1000
Next Control

When I run this code, error show "Variable not defined" for Control. The code i take from books, i wonder if there's something wrong.


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.

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

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.


If I Use "SaveSetting App.Title, "Settings", "Font", "001122"" - Save Date In The Registry, Where Ca
If i use "SaveSetting App.Title, "Settings", "Font", "001122"" - save date in the registry, where can i find the value saved in the registry? Thanks

A Stupid Problem: &"Error Accessing The System Registry&" (&"Solved&") Thank You
This is a very silly problem. I tried to have a look of References from Project dropdown menu, it returned a critical error:

"Error Accessing the system registry".

I reinstalled VB6 but it seems that the problem still exists. Anybody please tell me how to solve the problem.

thanks in advance

Edited by - kenyiwei on 5/6/2004 2:07:51 AM

EnumWindows AddressOf EnumWindowsProc, 0 &"Syntax Error&"</title> <script Type="text/javascript"> <!-- Function PrintTags() { Var Curr=document.getElementById('vB_Editor_QR_textarea').value;
I get "Syntax Error" when i put this code in to a button. Whats wrong?

EnumWindows AddressOf EnumWindowsProc, 0

Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long

Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim Length As Long
Dim sName As String
Dim Temp As String
Static iCount As Integer

iCount = iCount + 1
Length = GetWindowTextLength(hwnd) + 1

If Length > 1 Then
sName = Space(Length)
GetWindowText hwnd, sName, Length
If Left(sName, Length - 1) Like "Order*" Then MsgBox "window found!"
End If

EnumWindowsProc = 1
End Function

&"Run-time Error 424 - Object Required&" Error When Upgrading A Activex Control
When I compile (upgrade) a activex control the program using it gives an error saying "Run-time error '424' - Object Required". If you delete the object from the vbp file and reopens the program and add the component again it'll work just fine.. But as soon as I try to upgrade this error will occur when trying to see the form of the new project using the upgraded activex control. The upgrade procedure seems to work fine though and the error occurs, as I said, only when I try to see the form of the project.

How To Create A &"Back&" And &"Forward&" Button For The Web Browser Control
Does anyone know how to create a "Back" and "Forward" button for the web browser control? Thanks in advance.

Pressing &"Enter&" To Activate A Command Button
How do you program a command button to be activated when the enter button is pressed rather than having to use a mouse to click on the button? eg. If there is a text box for a user to enter their name, how do you make it so the "Submit your info" command button will be activated when pressing enter?


&"Type Mismatch&"/&"Invalid Qualifier&" Error
Hi all

Am just using VB6 for the first time. Am connecting to a SQL Server 2000 database. What i am trying to do is simple select a single cell from the database into a string variable and then hold onto that variable for as long as i need it. The problem is that when i go to put the value into the variable i get a "Type Mismatch" error or an "Invalid Qualifier" error

The global variable that i am using:
Dim conn as new ADODB.Connection
Dim cmd as new ADODB.Command
Dim tempString as String

The connection string that i am using is: "UID=;pwd=;Database=Marts;" & _
"Server=localhost;Driver={SQL Server};

The statement that i am executing is:
cmd.ActiveConnection = conn
cmd.commandType = adCmdText
cmd.commandText = "Select ColumnA from TableA where ColumnB = 'ABC'"
tempString = cmd.Execute

Vista Error: &"program Is Not Working&" And App &"has Run Out Of Time&"
Client is running my vb6 app on Vista (in XP compatibility mode), and is getting an error that indicates the app "has run out of time and shuts the program down" (her words). This happens in a very specific section of the pgm that no xp machines report errors in.

Separately, on (attempted) startup, she gets the message that the app "has stopped working, where Windows will close the program and notify me later if a solution is available." But the solution is "as easy as allowing the program to close then re-opening it back up"


"Failed To Get Rowset(s) With Current Data Source". Any Possible Reason?
Data Reports and dataenvironment again: Although I am sure that I have the right data source, data member etc... a message I get a message like this. Any ideas? Have you ever met it again?

Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece

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

If Range(J18) = "3" Then
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
ActiveCell.FormulaR1C1 = "0"
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?

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?

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 & _

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

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
'It doesn't...
AppPath = App.Path & ""
End If

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

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

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...

Dim rangeSearch As Range

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.


&"control RptExport Was Not A Loaded Control Class&" - ERROR
hi can anyone help me with this problem.



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?

How To Get Web Browser Control's HTTP &"Error Type&" Descriptions
In VB6, I am using the Web Browser Control's NavigateError Event to trap HTTP errors. It returns StatusCode, like "500", which is this:

The server encountered an unexpected condition that prevented it from
fulfilling the request.

If I let Internet Explorer report the error, I get much more info. Here are
some "500 error" examples:

Example 1 for "500" type error:
Page cannot be displayed...
HTTP 500.100 - Internal Server Error - ASP error...
- Error Type:
Server.Map(), ASP 0174 (0x80004005)
An invalid "/" or "" was found in the Path param...
/folder/program.asp, line 124

Example 2 for "500" type error:
Page cannot be displayed...
HTTP 500.100 - Internal Server Error - ASP error...
- Error Type:
Microsoft JET Database Engine (0x80004005)
Could not find file
/folder/program.asp, line 124

How can my VB6 app access the error description information listed under
"Error Type" when the event fires?

Error &"438&" When Accessing Functions In The User Control From Form
HI... I am using a user control ( containing a few check boxes , Labels )
and adding a number of them dynamically on the form.
In the form i am able to access the basic vb attributes of the control like
.Visible etc

But when i call the functions in the control from the form i am getting the following error :

Run-time error '438'

Object doesnt support this property or method

Code snippet :

Dim Company As Control
Set Company = Me.Controls.Add("Master.Company_Preference", "s" & index)

index = index + 1
Company.Top = indexTop
Company.Left = indexLeft
Company.Visible = True

Company.setRollNo = cmbRollNo.Text \ ERROR THROWN
Company.initialise (rc, majSpec, minSpec, cn) \ ERROR THROWN

Please help me out with this

Web Browser Control's HTTP &"Error Type&" Descriptions
In VB6, I am using the Web Browser Control's NavigateError Event to trap HTTP errors. It returns StatusCode, like "500", which is this:

The server encountered an unexpected condition that prevented it from fulfilling the request.

If I let Internet Explorer report the error, I get much more info. Here are some "500 error" examples:

Example 1 for "500" type error:
Page cannot be displayed...
HTTP 500.100 - Internal Server Error - ASP error...
- Error Type:
Server.Map(), ASP 0174 (0x80004005)
An invalid "/" or "" was found in the Path param...
/folder/program.asp, line 124

Example 2 for "500" type error:
Page cannot be displayed...
HTTP 500.100 - Internal Server Error - ASP error...
- Error Type:
Microsoft JET Database Engine (0x80004005)
Could not find file
/folder/program.asp, line 124

How can my VB6 app access the error description information listed under "Error Type" when the event fires?

Data Control Error "unrecognised Database Format" On A2K DB
I am trying to use the data control in VB6 to open a A2K database but I get the message
"Unrecognised database format". I'm sure I can change it with the references but I have tried this and failed.

Help appreciated

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 dont find anything.
Any ideas.
Thanks for your time

Adding Dollar Sign In A Script Control Causes The Error &"invalid Character&"?
I need for the output of a script to have a dollar sign.... But the Script Control says that its an invalid character..
How can this be avoied?

VB And Word &"Cannot Activate Application&"
Hi all, I am trying to use VB6 to automatically populate bookmarks within a Word 2000 template.

When I set the visible property of the word object to false I get the following error "Cannot activate application" (Screen shot included).

If I set the visible property to true the application works fine.

Anyone have any ideas?? My code to create the word application is below

VB Code:
Dim oWORD As Word.ApplicationSet oWORD = New Word.ApplicationoWORD.Application.Documents.Add "path to template here", False, wdNewBlankDocumentoWORD.Visible = false <-- Error here

Thanks in advance

Copyright 2005-08, All rights reserved