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




Error In Calcs....


Hi Everyone,

I'm trying to do some simple benchmarking routines...

three passes on the database,
each one returns x number of milliseconds.

Each millisecond is displayed on the form

Everything is OK up to this point.

I go to gather the values from the three times above,
thats all fine...

but when i do the division, i'm getting some crazy stuff....

Here is the code....



Private Sub Command4_Click()
'query view with union
Dim v1 As Double
Dim v2 As Double
Dim v3 As Double
Dim v4 As Double
Dim strSQL As String
strSQL = "select * from tblsystemsettings"
v1 = 0
v2 = 0
v3 = 0
v4 = 0
mMMTimer.StartTimer
Process_Query (strSQL)
mMMTimer.StopTimer
v1 = mMMTimer.ElapsedTime
mMMTimer.StartTimer
Process_Query (strSQL)
mMMTimer.StopTimer
v2 = mMMTimer.ElapsedTime
mMMTimer.StartTimer
Process_Query (strSQL)
mMMTimer.StopTimer
v3 = mMMTimer.ElapsedTime
Label16.Caption = v1
Label1.Caption = v2
Label9.Caption = v3
v4 = (v1 + v2 + v3)
Label17.Caption = v4 / 3

End Sub



Seems simple enough...

But the results are wrong....

button 1 click reports...
try 1 try 2 try 3 average
0.07 0.07 0.06 6.6666

button 2 click reports
try 1 try 2 try 3 average
0.06 0.07 0.081 7.03333

button 3 click reports
try 1 try 2 try 3 average
0.06 0.07 0.07 6.6666

button 4 click reports
try 1 try 2 try 3 average
0.06 0.06 0.08 6.6666



so whats up with this???

each button click calls the same code, and the same SQL

but i'm missing why the divided values are different???

thanks
tony




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
VBA && Time Calcs.
Hello.

I've got an Excel worksheet which holds data on certain things - we are using a VBA script to extract parts of this data and output it into a presentable format.

One of the fields taken is an accumulation of hours, like "30:00:00", for 30 hours, as an example.

We need to do a few calculations of this data before we output it. So, we are changing the value into a decimal, and then doing the calcs.

We are using CDec(CDate(the_time)) to get the decimal value of the time.

Problems occur because "30:00:00" is not a valid time.

We've tried many things to work around this, but nothing is happening.

How do we work with hour values like that in calculations in VBA?

Thanks.

NORMINV Calcs In VBA
Hi, does anyone know how I can use commands such as NORMINV and NORMDIST in VBA without having to use Excel?

Iterative Calcs
Hi all,

I have an Access database with a VB6 front end. The user is able to run modules that do iterative calculations on data in the tables.

The data could number up to 50,000 records in time. Each time a calculation module is run, the code will generally cycle through all the records 5-10 times before a solution is reached.

Which would be more efficient / faster:
Assign a field in each record for the interim calculations and update at each iteration; orAssign the interim calculations to an array that gets updated each iteration?
Hope this makes sense.

Thanks,
GJ

Time Calcs
I want to convert minutes to hours:minutes
(e.g 124minutes = 2.04)

Also I want to check if a time entered is between 13:00 and 13:30

Any ideas?

Time Calcs
someone gave me code to fix a problem with time keeping and it works! i lost the original email so i am not able to thank that person directly. thanks to whoever you are!!!

i need to solve another problem.

here is the original code:

dim ve as variant
dim ds as date
dim df as date

ds = Now()

do stuff.....

df = Now(
ve = Format$(df - ds, "hh:mm:ss")

i store ve into each record, i want to add them up to get the total time for the records i select to view, like maybe for a given month of records.

can a similar method be used to to the adding???

ve is stored in: TimeTrack.TotalTime

Ron

Working With Calcs On Data Fields
I have data objects that load random databases. I need to set and store formulas at run time, which I can reload again on next sessions to recalc values. I have walked into a brick wall here, any help is welcome.

I tried

calctest = Data1.Recordset.fields("Qty").Value * Data2.Recordset.fields("cost").Value

Data2.Recordset.fields("total").Value = calctest

which works fine. Now how do I save it so that I can reload the values for calctest.

Getting UDFs To Do More Than Return Values In Excel Calcs
Started thinking one night when I couldn't sleep about a question that is asked often:

"I have a user defined function that i have made and I want it to perform formats to a sheet when I enter it in an Excel formula (rather than accessing it by code) (eg colour a certain cell some colour, or merge some cells etc)."

Is this possible. The short answer is no. Microsoft designed it that way on purpose. But as I said I couldn't sleep so my mind wandered and I think I may have come up with a way for this to work.

This code relies on the worksheet_calculate event to call some code:


Code:
Private Sub Worksheet_calculate()
performaction
End Sub

Then performaction will look for the occurrence of the name of the formula (in this case 'myformula'):


Code:
Sub performaction()
Dim ws As Worksheet
Dim c As Range
Dim r As Range
Dim myrange As Range

For Each ws In ThisWorkbook.Worksheets
Set r = Nothing

On Error Resume Next
Set r = ws.UsedRange.Find(what:="myfunction", LookIn:=xlFormulas, lookat:=xlPart)
On Error GoTo 0

If Not r Is Nothing Then
Set myrange = r

Do

On Error Resume Next
Set r = ws.UsedRange.Find(what:="myfunction", after:=r, LookIn:=xlFormulas, lookat:=xlPart)
On Error GoTo 0

If myrange.Cells.Count = Union(myrange, r).Cells.Count Then Exit Do
Set myrange = Union(myrange, r)

Loop

''''Put the code to be performed here!!!

For Each c In myrange

'''Put your code here!

Next c

End If

Next ws

End Sub

The most important thing here is to give the udf a suitable name that will not be used for anything else. For example if you called the function 'sausages' and at various stages throughout the workbook you typed:

"I love sausages"

the code would run. But at the same time, it obviously needs to be something that can be remembered so it is useful.

An important note is that if you attach long code to the occurence of the udf or if it appears too many times this will slow down excel considerably as it will run every time the you enter a value into a spreadsheet. It is probably worth noting that this would happen if the code were in a udf anyway.

Any suggestions/ways to improve it would be much appreciated since I don't have a use for it, so no real reason to test properly.

Hope it helps someone!!!

Error Msg - "Run-Time Error '-2147417848(80010108)': Automation Error
I have a menu-item which when clicked starts up a browser and goes to the site which the user selected from the appropriate menulist. It works fine in VB6 when I click on the play button, (design time). However, after using the Package & Deployment Wizard, I get the following error message: "Run-Time error '-2147417848(80010108)': Automation Error What in the world is going on. Is it that the browser object is not installing correctly since it works in the VB6 environment? :-( Or is it some code that is creating the problem. I am still new at this, but making great progress. Just ready to get this beta out to some of my testers.

I was under the impression that if you could run the program during the design process without any problems, then you could run it after compiling and packaging with the Deployment Wizard.

email should be on my post,... however it is:
scrocker@midsouth.rr.com

Thanks,
Sal

Problem With Error-handling: First Error Handled, Second Error Breaks
Once again working with my Queue system, I have come across a bit of a strange problem. Right now I have the Queue set up as a loop where it processes all tasks until there are no more tasks remaining. Tasks are in sub-procedures, which are called from inside the loop. I have set up error-handling to be in the procedure with the loop (called PerformTasks). If one of the sub-procedures hits an error, the error-handling is taken care of by the PerformTasks sub.

The error-handling in PerformTasks is simple, it just raises an error event that will show up on a display to the user, then removes the task that caused the error, and then uses a GoTo to jump back in the processing loop. Here is a stripped-down example:


Code:
On Error GoTo PerformTasks_Error

'get the first task in the queue
lngTaskID = GetFirstTaskID

'check to see if there are actually tasks in the queue
While Not lngTaskID = -1

'get the details about this task
Set objTask = GetTaskDetails(lngTaskID)

'now based on the type of operation that must be performed, we do it
Select Case objTask.Task_Type

'do tasks based on select

End Select

'we need to remove the task here now, since otherwise we will loop endlessly
RemoveTask lngTaskID

'get the next task
lngTaskID = GetFirstTaskID

'do reporting at very end so that if there was an error we catch it as an
'error instead of reporting a completed and an error
'report the task completion via the event
RaiseEvent TaskCompleted(objCompletedTask)

'this lets us get back into the loop for continuing the queue after errors
Error_Resume:

Wend

'all of the tasks are complete so raise the all tasks completed event
RaiseEvent AllTasksComplete

Exit Sub

PerformTasks_Error:

'error, so remove task
RemoveTask lngTaskID
'get the next task
lngTaskID = GetFirstTaskID
'raise the error event
RaiseEvent TaskError(objTask)
'resume processing
Err.Clear
GoTo Error_Resume

The problem I'm having is that the error-handling only works for the first error. I have 4 RemoveFile tasks in a row that will all error out for the same reason (it's trying to delete a file that doesn't exist). The first time through, when the error happens, it jumps out of the RemoveFile sub and into my PerformTasks_Error as it should. The second time, however, it breaks with a "File not found" error. This is even though I have error-handling set to "Break on unhandled errors", and this SHOULD be handled - after all, it handles it the first time.

I added the line that says "Err.Clear" because I thought maybe I had to reset the error object after the first error catch...but that didn't help. I feel as though I might be on the right track with that tho, from this in the MSDN help:


Quote:




The Err object's properties are reset to zero or zero-length strings ("") after an Exit Sub, Exit Function, Exit Property or Resume Next statement within an error-handling routine. Using any form of the Resume statement outside of an error-handling routine will not reset the Err object's properties. The Clear method can be used to explicitly reset Err.




Any suggestions appreciated.

Network I/O Error Or System Error Device Error
 I am getting an Error. I believe it is a NetworkError DeviceError or SystemError
 I was wondering if someone knows how to trap these errors in VBA.
 There is a pressing need for a solution.
  Any help would be appreciated.
  Thanks Sirron

Error 70, Error 91 And Error List Separator
Hello!
I've got this problem:

I created a folder with visual basic

When I try to delete it(and only that dir...) with this code:

>Dim fso As FileSystemObject
>...
>fso.DeleteFolder defaultInstallFolder & "Config", True

I obtain "Permission denied", just like if folder is in use.. but it's in use from vb!
(The utility "Who lock me?" tells me that it's locked form vb)

I tried to change current dir to parent dir of folder to delete, but i didn't help.

If I try to delete directory just after have created, in another piece of code, the error changes:

"Object variable or With block variable not set"

I've read that perhaps it's a Microsoft bug, to solve using properties, so I made:

>Dim fso As FileSystemObject
> ...
> Public Property Get ob() As FileSystemObject
> ob = fso
> End Property

> Public Property Let ob(Object As FileSystemObject)
> fso = Object
> End Property

and tried to delete it using:

>Get ob.DeleteFolder defaultInstallFolder & "Config", True


but the error now is "Expected: list separator"

or I tried:

>Get ob().DeleteFolder defaultInstallFolder & "Config", True
>...
>Dim fso2 As FileSystemObject
>fso2 = Get ob (compile error)

The question is: HOW THE HELL CAN I DELETE THE FOLDER ? :-)

I can't understand the problem, I can easily delete other directories created in the same code 2-3 lines above, but THAT directory not. And neither in different Pcs, same problem.
I can only use vbcce5..

Thank you for responses!!

"On Error GoTo DoSomething_Error" Returns Error 0.. What Is Error 0??
Hello, I have a try/catch function is always is cought with an error0... What is an Error 0?

here is my code:


Code:
Private Sub ProcessCreditCard_Timer()
Dim CCstatus As String
Dim racAuthCard As Variant
Set racAuthCard = CreateObject("RACAuthcreditcard.Authcreditcard")

racAuthCard.transactionKey = "asdfasdfasfffff"
racAuthCard.login = "asfdsad"
racAuthCard.transactionType = "AUTH_CAPTURE"

Question = "Processing Credit Card Now. Please Standby."
On Error GoTo DoSomething_Error

CCstatus = racAuthCard.Authcreditcard(Total, CCnumber, ExpMonth, ExpYear, CCFirstName, CCLastName)
ProcessCreditCard.Enabled = False

If CCstatus = "This transaction has been approved." Then
Question = "Credit card transaction approved. One moment."
CCnumber = Right(CCnumber, 4)
Paidby = "Credit Card"
Call Thankyou
ElseIf CCstatus = "Problem! reason: The credit card number is invalid." Then
'CCnumber = Right(CCnumber, 4)
CCnumber = "0"
Question = "Credit Number invalid or NSF. Press the Start button to start again."
ElseIf CCstatus = "(TESTMODE) This transaction has been approved." Then
CCnumber = "TESTMODE" 'Right(CCnumber, 4)
Paidby = "TESTMODE"
Call Thankyou
Else
'CCnumber = Right(CCnumber, 4)
CCnumber = "0"
Question = "Authentication channel not found. Please try again in 30 seconds."
End If
Exit Sub



DoSomething_Error:
Select Case Err.Number
Case -2147012889 'cannot resolve DN
'MsgBox ("cnrdn")
CreditCardAuthRetry = CreditCardAuthRetry + 1
'Command1.Caption = CreditCardAuthRetry
If CreditCardAuthRetry > 100 Then
ProcessCreditCard.Enabled = False 'try for 1 second
Question = "Authentication channel not found. Please try again in 30 seconds."
End If

Case 0
'This is to catch all successful Credit Card Processes.. so it doesn't go to else

Case Else
'MsgBox ("Sorry we are having technical difficulties")
'email me the error number

ProcessCreditCard.Enabled = False

CCnumber = "0"
Question = "I am sorry, but we cannot take credit cards right now. "
'Call ClearAll


End Select


End Sub

and I know the credit card processing goes through fine (I can login to my merchant account and see it)...

what does an Error 0 mean, should I be worried? I basically setup my catch statement to ignore an error 0 .. but i want to know if that is a good idea .. or if i can "fix" this issue?

thanks!
Lee

Error 2147023067 (80070725) Automation Error" Launching Excel Sheet From VB App.
Hi All,
I have done a simple VB application that launches a excel sheet, this has worked proppely from my developement computer (WIN XP) and the package has been installed and the app. works propperly in another XP computer.When I have installed this same package in the Win 98 computer running the app. , launching the excel appears the message:
"Error 2147023067 (80070725) Automation error" , specifically at the code point:
wrbRes.Sheets(1).Range(strStart, strEnd).Borders(xlTop).LineStyle = xlSquare

I have done the same test in a WINNT developement computer (with VB installed) and I get the same trouble.
I have read that could be done due to an update of the windows system files when the package is installed.(OLEAUT.DLL specifically)
Thanks in advance for your help,
Al

VB 6 - Run-Time Error 3075 Syntax Error (Missing Operator) In Query Expression
Hi all
sorry for the inconveniences, I just wanna get this syntax thing out of my back.

I modified my vb module and now I'm getting "Run-Time error 3075 syntax error(Missing operator) - query expression"

Then it displayed this line of code as the problem line:

Code:
'TblPersonnel.[Name] = TblRequests.Personnel1 Union All
Select TblRequests.ProjectID'.

Below is the complete module:

Code:
DbPath = "\515opsisdallf00008SHAREDPyrlAppsPTStest2"

DbName = "PTS.mdb"

Set Db = OpenDatabase(DbPath & DbName)

strSQL = "Insert Into TblProgrammersHours (ProjectID,ProgrammerInitials, CurrProgHrs, PrevProgHrs, TotalProgHrs, Positions)"

strSQL = strSQL & " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog1hrs, TblRequests.PrevProg1Hrs, TblRequests.TotalProg1hrs, 1 As Position " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel1 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog2hrs, TblRequests.PrevProg2Hrs, TblRequests.TotalProg2hrs, 2 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel2 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog3hrs, TblRequests.PrevProg3Hrs, TblRequests.TotalProg3hrs, 3 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel3 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog4hrs, TblRequests.PrevProg4Hrs, TblRequests.TotalProg4hrs, 4 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel4 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog5hrs, TblRequests.PrevProg5Hrs, TblRequests.TotalProg5hrs, 5 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel5 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog6hrs, TblRequests.PrevProg6Hrs, TblRequests.TotalProg6hrs, 6 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel6 "

strSQL = strSQL & ") As NewProgHrsTbl"

Call Db.Execute(strSQL)
Thanks.
tgifgemini

Run Time Error (80040111) Automation Error ClassFactory Cannot Supply Requested Class
Anyone ever get this error ?

Run-time error '-2147221231 (80040111)':

Automation error
ClassFactory cannot supply requested class

I get this error when i am doing a Set MyShortcut = VBsObj.CreateShortcut(ShortCutPath & ".lnk")

I am only trying to create a shortcut here...and the server running this program is Windows 2000... Please advise..

Microsoft Visual Basic File Not Found Error When Openining Excel. Error 53
Hi

I am getting the below message each time I open excel:

Microsoft visual basic File not found error when openining excel. Error 53



What is it,What caused it and how do I get rid of this message when I open excel.


I have a series of macros in VBA and a VB6.0 application.


Many thanks

Setup Creation Error(Unexpected Error Number 28 Has Occurred.Out Of Stack Space)
Hello everybody,

Iam using VB6.0 with CR8.5 and backend as MS Acess.
During setup creation it gives me an "unexpected error number 28 has occurred.Out of Stack space". plz help me out with proper solution
Thanx in Advance

Run-time Error '3077' Syntax Error (missing Operator) In Expression - Is Comming, Plz Help
Hi everyone

I made a small project in VB and getting error sometimes on this line.

it come when A contain ( ' or " )

it does not come when A does not contain this charactor ( ' or " )


Code:
Text1.Text = lstFilSrch.Text
Dim a As String
a = Text1.Text
Data1.Recordset.MoveFirst
Data1.Recordset.FindNext "hindi= '" & a & "'"



Thank
Rishi Acharaya

RunTime Error 3075 - Syntax Error (Missing Operator) In Query Operession
Hi all
sorry for the inconveniences, I just wanna get this syntax thing out of my back.

I modified my vb module and now I'm getting "Run-Time error 3075 syntax error(Missing operator) - query expression"

Then it displayed this line of code as the problem line:
Code:
'TblPersonnel.[Name] = TblRequests.Personnel1 Union All
Select TblRequests.ProjectID'. <==== Error occurs here


I can't seem to figure out why my SQL statement is bumming out on the above line.

Below is my complete module:
Code:
DbPath = "\515opsisdallf00008SHAREDPyrlAppsPTStest2"

DbName = "PTS.mdb"

Set Db = OpenDatabase(DbPath & DbName)

strSQL = "Insert Into TblProgrammersHours (ProjectID,ProgrammerInitials, CurrProgHrs, PrevProgHrs, TotalProgHrs, Positions)"

strSQL = strSQL & " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog1hrs, TblRequests.PrevProg1Hrs, TblRequests.TotalProg1hrs, 1 As Position " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel1 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog2hrs, TblRequests.PrevProg2Hrs, TblRequests.TotalProg2hrs, 2 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel2 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog3hrs, TblRequests.PrevProg3Hrs, TblRequests.TotalProg3hrs, 3 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel3 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog4hrs, TblRequests.PrevProg4Hrs, TblRequests.TotalProg4hrs, 4 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel4 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog5hrs, TblRequests.PrevProg5Hrs, TblRequests.TotalProg5hrs, 5 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel5 "

strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog6hrs, TblRequests.PrevProg6Hrs, TblRequests.TotalProg6hrs, 6 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel6 "

strSQL = strSQL & ") As NewProgHrsTbl"

Call Db.Execute(strSQL)


Thanks.
giftx

Runtime Error '3077' Syntex Error (missing Operator) In Expression
Hi everyone,

I have a combo box on a form that finds records in a table or query. It works fine except for string with an apostrophe on it - and the string is,

IED_Headcount 'ADODB' error message

It gives me a Runtime Error '3077' Syntex error (missing operator) in expression. I found out the reason I am getting this error is because the word 'ADODB' has aphostrophe on it.

My code for the Find Records Combo Box is,

Private Sub Combo84_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Issue] = '" & Me![Combo84] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

Can you please help me with the necessary code to escape the error.

I certainly appreciate your help and thank you in advance.

Dewan

On Error Return False?? VB Will Treat A Statement As True If Error Occurs In It
VB Code:
On Error Resume Next    Dim zrr() As String        zrr = Split("", " ")        If zrr(1) = "001" Then        MsgBox "help"    End If

clearly, i should not be getting that msgbox, but i do
its even more annoying when u have something like


VB Code:
dowb.navigate "www.hotmail.com"doevents: sleep 10loop until wb.busy = false or instr(wb.document.documentelement.innerhtml,"login") > 0

this will just execute the next lines even though both statements are false (but sometimes an error will occur on the wb.document.documentelelement statement)..

does anyone know a good way to get around this?

a side note: im checking if 'login' (as an example) exists in the html, because there is no need to load the entire page, i can perform my code once data upto this point is received

Excel XmlHTTP Object Error Message - System/runtime Error
Hi guys,

Thanks for reading my thread. This is a VBA problem for something in Microsoft Excel - I wasnt sure if I should really be posting this problem on this kind of forum, so apologies if I am in completely the wrong place! I have looked on google and used the search feature and found very limited information that is useful to me.

I am having trouble with a very simple few lines of code in a macro. The code looks like this:



Code:


Function startmarketIDs()

Dim targeturl, writerow, readrow, textmass, xmlHTTP

targeturl = "http://lite.betfair.com/Events.do?s=00010913z"

Set xmlHTTP = CreateObject("Microsoft.xmlHTTP")

xmlHTTP.Open "GET", targeturl, False
xmlHTTP.send

MsgBox xmlHTTP.StatusText
textmass = xmlHTTP.responsetext

MsgBox textmass

End Function



My problem occurs at the line "textmass = xmlHTTP.responsetext"

The responsetext command is obviously causing problems because if I remove it, the code executes without error and the "xmlHTTP.statustext" says "OK". With the responsetext command left in, the code generates the following error:

Run-time error '-1072896658 (c00ce56e)':

System Error: -1072896658.

If I change the targeturl to www.betfair.com, the code executes fine and I get a message box (as desired) with the source code of the website displayed. There is therefore something about the url or the way in which I am using the xmlHTTP object that is causing the issue, I wondered if someone would mind inspecting my code and perhaps pointing me in the right direction?

I am not an expert in VBA programming, and I feel a little out-of-my-depth using the xmlHTTP object, but Id really like to get hold of the source code of the targeturl so that I can parse it for some data that I require. Thanks to anyone who can offer me any assistance,

Regards,

Porky / Paul

Visual Basic Runtime Error "Error Saving Document
Dear all,
I am saving a document from vb. While saving I get this error. This error occurs only when I run the exe file. This problem doesnt occur while developing the project.
There is no problem with the path. What else may be the problem?

How to rectify this error " Error saving Document" in visual basic 6.0

Pls Help, this is very urgent.

Thanks to all.

Rgds,
Visha

Error ('20527' Sql Server Error) While Connecting ADO Recodset To Crystal Report
Error ('20527' sql server error) while connecting ADO recodset to crystal report
...?

Error Visual Basic: ! Compile Error. Can't Find Project Or Library
Hi all,

When running a program I made in VB under Windows XP i'm getting the
following error: ! Compile error. Can't find project or library. (see also
http://home.kabelfoon.nl/~hspies/2.jpg )

See the code where it stucks: http://home.kabelfoon.nl/~hspies/1.jpg

Ubder Windows 98 this error does not occur. Who knows what I do wrong, I've
tried a lot but the error keeps coming in Win XP. Thanks.

John

Error -2147467259 - Unspecified Error - Pointing To DB Connection String ? (URGENT)
I have had my system running on and off in memory for some time now (maybe a couple of hours)...

On my most recent compilation/execution of the system, I was able to open and close several forms before I was presented with an error.

After I had opened and closed around 5 forms, and tried to open another, this error appeared:

Error -2147467259
Unspecified Error

Highlighting in yellow this line in my Form_load:
Code:
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & ConnPath & "MyDatabase.mdb";



I have also just tried adding a record, it works fine.
I add 5 records, adding them fine.
When I get to around 10, this error comes up again, and points to the same line on my connection string.


NOTE: Nowhere have I closed my database (eg. db.close)

Everytime I am saving my records I am refreshing the form to be sure it is up to date.

Could this be causing the problem?

Do I need to close the database and then reopen after every transaction ?


Thanks

SQL7 Stored Procedure Error: Syntax Error Or Access Violation
Using VB6 SP5, ADO 2.7, Sql7 SP4.

When I try to execute any stored procedure I get the error:
Run-time error '-2147217900 (80040e14)':

Syntax error or access violation

    Dim cAck As ADODB.Command, cParam As ADODB.Parameter
    Set cAck = New ADODB.Command
    cAck.name = "sp_Test1"
    cAck.CommandType = adCmdStoredProc
    cAck.ActiveConnection = oCon
    cAck.Execute

oCon is connection that is made prior and specifies the inital catalog. I can do anything else using this including views and update queries but when I try to access any stored procedure I get the above error. I even scaled back to a simple stored procedure that does nothing and get the same error.

Truely lost on this one.

-J

Create Package Error; "Unexpected Error Number 380 Has Occured;invalid Property Value
Hi all,

I try to create a package in visual basic; However, I found the following error. "Unexpected error number380 has occured; Invalid property value". My development environment ,
OS: Win2000
VB: Visual Basic 6.0

Thanks a lot .

Regards,
Edward Hui

E-mail (plz Help Me With Code) Error Message Compile Error: ByRef Argument Type Mismatch
hi!,

I am trying to get help since 4 weeks but I haven't had an reply.

I am creating a software. I am using "Microsoft Access". This is what the software does. The user chooses a category from the category combo box. This category is coming from the database. When the user has choose the category that category details come into the "Microsoft Flex Grid" such as item name and price. The user then chooses which item they want by using the "Forward" command button. The item names are added to the list box. The user then enters details such as name and surname. After this when the user clicks on the "Submit" command button the items in the list box and details are added to the database. This is what i want. I want to send an e-mail to the customer. when I click on the "Submit" command button i get this error message Compile error: ByRef argument type mismatch and also the code is highlighted.

This is the code.

Code:
Private Sub cmdSubmit_Click()
Dim sql As String
Dim cmdCommand As ADODB.Command 'declare command object

Set cmdCommand = New ADODB.Command 'command object is instantiated
cmdCommand.ActiveConnection = g_dbExoticicesConn 'valid connection object that is already open
cmdCommand.CommandType = adCmdText 'CommandType is set
'Counter that goes through listbox items
Dim tmp
For i = 0 To List1.ListCount - 1
     tmp = tmp & "-" & List1.List(i)
Next i

        'Insert Into the Database
        sql = "Insert Into tblCustomerOrderForm(CustItems) values ('" & tmp & "')"
        cmdCommand.CommandText = sql
        cmdCommand.Execute
   
Set cmdCommand = Nothing
'Assign all the text boxes to the field
adoExoticices.Recordset!CustTitle = IIf(txtCustTitle = "", "N/A", txtCustTitle)
adoExoticices.Recordset!CustName = IIf(txtCustName = "", "N/A", txtCustName)
adoExoticices.Recordset!CustSurname = IIf(txtCustSurname = "", "N/A", txtCustSurname)
adoExoticices.Recordset!CustAddress = IIf(txtCustAddress = "", "N/A", txtCustAddress)
adoExoticices.Recordset!CustCounty = IIf(txtCustCounty = "", "N/A", txtCustCounty)
adoExoticices.Recordset!CustCity = IIf(txtCustCity = "", "N/A", txtCustCity)
adoExoticices.Recordset!CustPostcode = IIf(txtCustPostcode = "", "N/A", txtCustPostcode)
adoExoticices.Recordset!CustTelephonenumber = IIf(txtCustTelephonenumber = "", "N/A", txtCustTelephonenumber)
adoExoticices.Recordset!CustMobilenumber = IIf(txtCustMobilenumber = "", "N/A", txtCustMobilenumber)
adoExoticices.Recordset!CustEmailaddress = IIf(txtCustEmail = "", "N/A", txtCustEmail)
adoExoticices.Recordset.Update
MsgBox "Record has been successfully Updated", vbOKOnly + vbInformation, Message
Call SendMail(strSendTo, strSubject, strMessage) 'strSendTo is highted.
End Sub
 

Code:
Private Function SendMail(strTo As String, strSub As String, strMsg As String)
'opens link to outlook and then creates a mail item
    '*******************************
    'declare objects'
    Dim olApp As Outlook.Application
    Dim olNS As NameSpace
    Dim olMessage As MailItem
    '******************************
    
    '**********************************************
    'instantiate objects
    Set olApp = CreateObject("Outlook.Application")
    Set olNS = olApp.GetNamespace("MAPI")
     
    Set olMessage = olApp.CreateItem(olMailItem)
    '**********************************************
    
    '*************************
    'set the properties of the object
    olMessage.To = strTo
    olMessage.Subject = strSub
    olMessage.Body = strMsg
    '*************************
    olMessage.Send 'send method of object
     
    olApp.Quit 'quit method of object
     
    'clear the objects to free up memory
    Set olApp = Nothing
    Set olNS = Nothing
    Set olMessage = Nothing
    
    'declare string variables'
    Dim strSendTo As String
    Dim strSubject As String
    Dim strMessage As String

    strSendTo = txtCustEmail.Text
    strSubject = "Exoticices"

    strMessage = "Reference Number: " & txtId.Text & vbNewLine
    strMessage = txtCustTitle.Text & txtCustSurname.Text & vbNewLine
    strMessage = "The items you have requested to order are being ordered and we will contact you when the items will be delivered. The items will take 28 days to be delivered."
End Function
 

What shd I do? Can u send me sample code. If u send me sample code can u plz explain what the code means.

Anways plz let me know as soon as possible.

Thank you for ur help in this matter.

Can u plz let me know any changes.

Graph Report In Crystal Reports 8.5 Shows Error (Automation Error. The Object Invoked Has Disconnect
Dear All,

while calling a report containing graph from VB 6.0 I found following error,

"Automation Error. The object invoked has disconnected from its clients"

but when I install crystal reports 8.5 on client machine then the error disappears.

can anybody advice?

Best Regards,Shahzad Anwar 92-345-8237099

MSComm Error 8020(Error Reading Comm Device)
Does anyone know more about this error?
Communication with a modem connected on a serial port gives no problems, but the same code gives run-time error 8020(Error reading comm device) when I want to work with a gsm mobile over infrared (I can read the inbuffercount property of the msComm object, but the reading the input property throws the error).

code as follow:
MSComm1.Settings = "9600,N,8,1"
MSComm1.CommPort = 4
MSComm1.PortOpen = True
MSComm1.Output = "AT" + vbCr

retStr = MSComm1.Input
intRet = MSComm1.InBufferCount

Thank you for your reply.

Getting A Run-time Error '3134' Syntax Error In INSERT INTO Statement
Code:
Private Sub cmdMass_Click()
Dim db As Database

Dim rs As Recordset

Dim datHold As Date

Dim datStart As Date

Dim datEnd As Date

Dim intID As Integer

Dim strSQL As String

Set db = CurrentDb

Set rs = db.OpenRecordset("qryEmployeeIDs") 'gets unique IDs

rs.MoveFirst

datHold = #12/30/2000#
datStart = datHold

Do While Not rs.EOF

Do While datEnd < #4/1/2006#
datEnd = DateAdd("d", datStart, 13)
intID = rs![Employee_ID]
DoCmd.SetWarnings False

strSQL = "Insert tblSick_Leave(Employee_ID, Pay_Period_StartDate, Pay_Period_EndDate,
Begining_Balance_Hours, Begining_Balance_Minutes, Earned_Hours,
Earned_Minutes, Used_Sick_Hours, Used_Sick_Minutes,
Ending_Balance_Hours, Ending_Balance_Minutes) Values ('" & intID & "', #" &
datStart & "#, #" & datEnd & "#, '0', '0', '0', '0', '0', '0', '0', '0')"
datStart = DateAdd("d", datStart, 14)
Loop
rs.MoveNext
Loop
rs.Close
db.Close

Set rs = Nothing
Set db = Nothing

DoCmd.SetWarnings True


End Sub
First, allow me to say that I have broken the statement down to multiple lines for readability issues here. Basically, what I want it to do is insert the date ranges for previous pay periods into the table or each employee as well as entering 0 into the record for each other field in the table. I am having a few issues with that as I am getting this error and I have tried everything to get it to work, but I keep getting this runtime error. Any thoughts on this?

Error 1004: Application-defines Or Object-defined Error
Hello there,

while trying to write a script I get this error.
Here is minimal script which reproduces the error (working with Win XP and Office 2003 Sp3).

Code:
Function foo()
On Error GoTo Hell
Dim i As Integer
For i = 1 To 4
Dim r As Integer
r = Application.Caller.Row
Dim c As Integer
c = Application.Caller.Column
Dim s As Integer
s = Application.Caller.Worksheet.Index
MsgBox ("Sheets(" & s & ").Cells(" & r & ", " & c & ")")
Sheets(s).Cells(r + i, c + i) = "bar" ' this line produces the error
'Sheets(1).Cells(1,1) = "bar" produces the same error :(
Next i
foo = i
Exit Function
Hell:
MsgBox "Error-No.: " & Err.Number & vbNewLine & vbNewLine _
& "Description: " & Err.Description _
, vbCritical, "Fehler"
End Function
I tried to ask google, but I could not find any working results.
I really hope anybody here can point me to a solution.

Regards

Declaring An Error Handler / On Error GoTo In The General Declarations?
Ive been reading in books that somehow you can declare an On Error GoTo ErrorHandlerProcedure in a forms general declarations, and also to declare the actual error handler itself in the general declarations...

But when I tried this it didnt work!

It didnt show an example, but I'm guessing its written the same way as you'd normally write an On Error GoTo and the Error Handler, but maybe I'm wrong?


Can anyone please help by giving me an example of how its done?


Thanks

VB Error While Connecting To Oracle =Run-time Error '-2147467259 (80004005)'
I have created a VB program using VB6 to connect to Oracle8i Release 8.1.7.0.0. Below is DLL that i use and my connection string.

microsoft ActiveX Data Objects 2.5 Library
"Provider=MSDAORA.1;Password=" & strpassword & ";User ID=" & strUserId & ";Data Source= & strdbservice

This error occurred while connecting :
"Run-time error '-2147467259 (80004005)':
oracle error occurred, but error message could not be retrieved from oracle."

However, after 3 - 4 times of attempt i manage to connect to the database without any problem. So each time i run my vb file I need to click a few times until it manage to go through my itself.
Average attempt is 3 times.

Please help.

'Error In GetMaxIssue: ActiveX Component Can't Create Object' Error???
Hi I have the above error.
The VB code accesses mdb database and works OK when package installed. (package developed by external group)

BUT when this package is uninstalled and I install my new install :-

I have created a new install, that copies program files and installs MDAC 2.5.

Can anyone help me with what Dlls/components are missing to get the above error??????


This is the connection to Database:-
Set rs = New ADODB.Recordset
sSQL = "Select Max(IssueNo) From Issues"
rs.Open sSQL, oADOCon, adOpenStatic

Thanks

Matt

Crystal Report Error 20534: Error Detected By Database Dll
Hi,

Can anyone tell me what this error means and how can I solve it?
I am using vb6 app, crystal report 8 and access 97. I try to open a report which is connected to sql table when this error occurs.
Thanks for help.

Validation Error. When Record In MySQL Not Present, Shows Error.
I have a form that searches a MySQL database using ADODC. When the order id entered exists it shows the information without a problem. However,when the order id is not present, it shows the following error message. I would like for it to bring up a msgbox instead telling the user that the order ID does not exist. (Code is provided.) Please help if you can.

When I click the debug button, the following line is highlighted:

VB Code:
lblUsername.Caption = Adodc2.Recordset.Fields("UserName").Value


Error Message:
Run-time error: '3021':
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.


VB Code:
Private Sub btnViewTranscriptionOrder_Click()'search the member database depending on the order IDIf txtTranscriptionOrderID <> "" ThenAdodc2.RecordSource = "SELECT * " _& "FROM transcribe" _& " WHERE nomer = '" & txtTranscriptionOrderID & "'"Adodc2.Refresh 'now display all the information for that transcription order idlblUsername.Caption = Adodc2.Recordset.Fields("UserName").ValuelblSenderFirstName.Caption = Adodc2.Recordset.Fields("SenderFirstName").ValuelblSenderLastName.Caption = Adodc2.Recordset.Fields("SenderLastName").ValuelblSenderAddress.Caption = Adodc2.Recordset.Fields("SenderAddress").ValuelblRecipientFirstName.Caption = Adodc2.Recordset.Fields("RecipientFirstName").ValuelblRecipientLastName.Caption = Adodc2.Recordset.Fields("RecipientLastName").ValuelblRecipientAddress.Caption = Adodc2.Recordset.Fields("RecipientAddress").ValuelblBrailleTranscriptionType.Caption = Adodc2.Recordset.Fields("BrailleType").ValuetxtTranscriptionText.Text = Adodc2.Recordset.Fields("LetterContent").ValueElseMsgBox ("Transcription ID does not exist.")End IfEnd Sub

SQL Error ODBC Visual FoxPro Driver: Syntax Error
Can somebody tell me what is wrong about the query (bold) and a solution for it?


VB Code:
Public cn As New ADODB.ConnectionPublic rs As New ADODB.RecordsetPublic cn2 As New ADODB.ConnectionPublic rs2 As New ADODB.Recordset Private Sub cmdOpenBron_Click()    Dim naam As String        Set cn = New ADODB.Connection    cn.Open "Driver={Microsoft Visual FoxPro Driver};" & _            "SourceType=DBC;" & _            "SourceDB=J:BjornDatadubois.dbc;" & _            "Exclusive=No"    Set rs = cn.Execute("Select * from KLPX")        Set cn2 = New ADODB.Connection    cn2.Open "Driver={Microsoft Visual FoxPro Driver};" & _            "SourceType=DBF;" & _            "SourceDB=C:WINBOOKSdataParfiNV;" & _            "Exclusive=No"                Set rs2 = cn2.Execute("Select * FROM PARFINV_csf")     While Not rs.EOF        While Not rs2.EOF            If Not rs![KL_NAM] = rs2![NAME1] Then                naam = rs![KL_NAM]                  [b]cn2.Execute "INSERT INTO PARFINV_csf [(NAME1)] VALUES '" & naam & "'"[/b]            End If        Wend    Wend     cn.Close    Set rs = Nothing    Set cn = Nothing    cn2.Close    Set rs2 = Nothing    Set cn2 = Nothing


Thanx alot in advance

Run-time Error '40006' : Wrong Protocol .... &lt;== How This Error Occurs?
Run-time error '40006' :
Wrong protocol or connection state for the requested transaction or request.

How this error occurs?
What error is it about?
How can we fix this error?

In my vb-application I used winsock and timer control.
And set timer to run every 5 minute.
But this error occurs unexpectially.

Best Regards

Starting To Pull Hair Out. On Error Ignore Error Control. Help!
Ok i posted about this yesterday and tryed a few things but it still did not work for me.

A runtime popup error occures when the first "If Dir" executes. But only if I do not have access to the share. Even though the "on error" code is there. I have tryed using a goto and label also but that doesn't work either. I have the settings on the general tab set to "Break on unhandled errors"


Code:
On Error Resume Next
If Dir("\" & strServerName & "c$
avupd
avplay.exe") <> "" Then
If Dir("\" & strServerName & "c$
avupd
avplay.exe") <> "" Then
Text = "Installed"
Else
Text = "Not Installed"
End If
Else
Text = "Not Installed"
End If

Package And Deployment : Error 75 : Path/file Access Error
I am trying to build a setup package for a VB 6 project. I get a "Unexpected error 75:Path/file access error" and
writing setup.lst goes on forever.
I tried to remove all references but the error still persists. Could somebody please let me know what could be the possible solution to this.
Thanks.

Error 1603: Error Installing Windows Installer Engine.
Hello,
I hope someone can help me and also sorry if I have the wrong forum!
I work in Technical Support for an Insurance company. We have recently changed the installer of the software to InstallShield and I have two users who are both using Windows NT and are having major difficulties loading on our software.
The Error message they are getting is:

Error 1603: Error installing Windows Installer engine. A file which needs to be replaced may be in use. This installation package cannot be installed by the windows installer service. You must install a newer version of the Windows Installer Service.

I have gone through a download of Windows Service Pack 6 for NT.

I have also tried to download instmsiw.exe but then get this message:
There was a problem with this Windows Installer Package. A program run as part of the setup did not finish as expected.

I also tried to download the Windows SoapToolkit as I looked on the Internet for information and the info I found was very similar to another problem that we have which is fixed by installing this SoapToolkit. However this will not load on my users machine.

I hope all this has made some sense!!
If you have any information for me at all it would be greatly appreciated!
Thank you

App.LogEvent Error -2147024882 (System Error &&H80004005 (-2147467259).
Hi all,

I knocked up a project and decided to use App.LogEvent to log errors, so I set up the event log:

CODE    Call App.StartLogging(sUnusedFileName, vbLogToNT)

Declaring An Error Handler / On Error GoTo In The General Declarations?
Ive been reading in books that somehow you can declare an On Error GoTo ErrorHandlerProcedure in a forms general declarations, and also to declare the actual error handler itself in the general declarations...

But when I tried this it didnt work!

It didnt show an example, but I'm guessing its written the same way as you'd normally write an On Error GoTo and the Error Handler, but maybe I'm wrong?


Can anyone please help by giving me an example of how its done?


Thanks

Edit By Shandy: Moved from VB Databases to VB Newbies forum - Please post in forum appropriate to question content



Edited by - Shandy on 4/17/2004 9:18:22 PM

ERROR 3077 : Syntax Error (Missing Operator) In Expression
Hi,

I am trying to use the "Findfirst" method to locate records in my database.
However, the command just raises the Runtime error 3077

please help!!!!!!!!!!

I've inserted the code below!



Code:Private Sub commloadform_Click()
Dim testno As String

DataList.Recordset.MoveFirst

Do While Not DataList.Recordset.EOF
     DialogWhichTest!TestNoCombo.AddItem (DataList.Recordset.Fields("Job Number").Value)
     DataList.Recordset.MoveNext
Loop

DialogWhichTest.Show vbModal, FormICS2000
testno = TestNumberForICS2000

If testno = "" Then
    Exit Sub
End If

findtest = "Job Number = '" & CStr(testno) & "'"

DataList.Recordset.FindFirst (findtest)

Call UpdateDisplay

End Sub

VB.Net, SQL Server, Primary Key Error: Show PK Field Value In Error Message
Hello,

VB.Net, SQL Server, primary key error:
Is it possible to show the value of a primary key field in an error message, to easily correct the error?

Thanks

Client Side RDS Error 8447 (Internet Server Error)
I have an windows application communicating with MTS business objects via RDS. The application has been in use since 1999 and working successfully with a variety of remote clients. I have one new client that keeps getting an 8447 Internet Server Error. They are the only ones, so it does not appear to be an ADCLaunch security type of error. The business objects were created using MDAC 2.6 and the client is running Windows 2000, IE 5 SP1, MDAC 2.7 and is behind a Cisco Pix firewall. Any ideas? Much appreciated!

Run-time Error '8020' Error Reading Comm Device
hi,

how to solve Run-time error '8020' - (Error reading comm device )

any ideas?

thanks

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