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

What Do I Get: "wrong Number Of Arguments Or Invalid Property Assignment"

What is wrong with this code that would give me this error:

compile error:
wrong number of arguments or invalid property assignment


Private Sub Command1_Click()
Dim rs As ADODB.Connection

Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C: est.mdb;"


rs.Open "Select Black FROM Colors;", conn, adOpenStatic, adLockOptimistic

Text1.Text = rs(0)


End Sub

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
"Wrong Number Of Arguments Or Invalid Property Assignment".

I'm a VB newbie. I'm getting the following error in my program at db.Execute:

"Wrong number of arguments or invalid property assignment".

Here's what I'm doing......

I have VB data entry form that is supposed to write to 2 related tables (PatientVisits and PatientConsultation) in the same Access database via a Query called VisitConsult.

In VB, when the user clicks on the Save button, I open the database and issue the following INSERT INTO command:

intFee = CInt(Fee.Text)
Dim db As Connection
Set db = New Connection
adoPrimaryRS.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51; Data Source=C:pispis-97_2.mdb;"

db.Execute "INSERT INTO VisitConsult(PatientVisits.Identity_Number,PatientVisits.VisitRefNumber," & _
"Doctor, DateofVisit,Fee_Paid,PatientConsultation.Identity_Number, PatientConsultation.VisitRefNumber," & _
"Symptoms,Diagnosis,Treatment,Referral) VALUES(patientvisitID.Text,visitRefLabel.Text," & _
"Combo2.Text,Date,intFee, patientvisitID.Text,visitRefLabel.Text,Symptoms.Text," & _
"Diagnosis.Text, Treatment.Text,ReferralBox.Text)", db, adOpenStatic, adLockOptimistic
What am I doing wrong?

Thanks in advance.

Edit by moderator: Please use [vb] tags and line breaks to format your code.

Format Function Error - "Wrong Number Of Arguments Or Invalid Property Assignment"

I have searched google and this board but am unable to solve this issue. I am getting this error on the ".FrameProgress.Caption" line. Why am I getting this error? I have other procedures using Format and it works while I am getting this error on other Format functions.

This is VBA in excel XP

Sub UpdatePBar(pctDone As Single, Optional Cap As String)

With pBar

If Cap <> "" Then
.lbStatus = Cap
End If

.FrameProgress.Caption = Format(pctDone, "0%")
.LabelProgress.Width = pctDone * (.FrameProgress.Width - 10)
End With
' The DoEvents allows the userform to update
End Sub


Help! "Wrong # Of Arguments Or Invalid Property Assignment"??????
Have recorded alot of macros in an excel file - many of which require the selection of a range of values in the execution of the commands...any macro or sub with a range("cell1;...celln").select syntax in it seems to be burping at this point - any ideas as to why? I'm desperate - have a deadline I'm up against and my file's far from working...thanks in advance...roni72

Wrong Number Of Arguments Or Invalid Property Assignment

I'm trying to go through a UDT array (code below) but get a "wrong number of arguments or invalid property assignment" error at the bolded bit (Course.Participents is a Get Property that returns an array):

Dim l As Long

For l = 0 To UBound(Course.Participents)
lsParticipents.AddItem Course.Participents(l).ipFullName
Next l

help would be appreciated

Wrong Number Of Arguments Or Invalid Property Assignment?
Hey there, I'm new to this forum and VB programming, so sorry if this seems like a noobish question.

Basically for a school project I have to create a lottery program which generates six random numbers, then performs a bubble sort to sort these numbers into order and then display them in a picture box. I've been struggling with this for days, I have no idea but my code looks OK to me, and whenever I click the command button which is associated with this code I always get an error message saying "Wrong Number Of Arguments Or Invalid Property Assignment" and always highlights the first "Populate_List list()" part.

Here's the code:

Option Explicit
Dim Counter As Integer
Dim list(6) As Variant

Private Sub CmdStart_Click()
'Generates six random numbers between one and forty eight and performs a bubble
'sort on them.
Populate_List list() (this part is always highlighted when I try to click CmdStart)
Bubble_Sort list()
End Sub

Private Sub Populate_List()
Dim Fill As Integer
For Fill = 0 To 6
list(Fill) = Int(48 * Rnd) + 1
Next Fill
End Sub

Private Sub Bubble_Sort()
Dim Outer As Integer
Dim Inner As Integer
For Outer = 6 To 0 Step -1
For Inner = 0 To Outer - 1
If list(Inner) > list(Inner + 1) Then
Temp = list(Inner)
list(Inner) = list(Inner + 1)
list(Inner + 1) = Temp
End If
Next Inner
Next Outer
End Sub

Private Sub Output_Results()
Dim Count As Integer
PicResult.Print " ";
For Count = 0 To 15
PicNumbersOne.Print list(Count);
Next Count
End Sub

Any help you could give me would be much appreciated.

EDIT: This problem has been solved, but now I have another.

OK, so after the random numbers have been generated, the user then enters six numbers between one and fifty, which are also displayed in a picture box. This is fine, and these numbers are stored in the array yournumbers. However, the problems start when the user clicks the CmdCheck Button, which is for the user to check their "winnings". The basis of this part was that the two arrays (one for the random numbers and one for the user entered numbers) are compared using a binary search and if a number the user entered matches one of the randomly generated numbers then a value of one will be added to a variable called "Winnings", and once all of the numbers have been compared then the final value of Winnings would be used in a Select...Case statement to determine how much the user would win. However, I seem to have hit a bit of a snag, as when I click the command button to start this a message box comes up saying "Next Without For". I have no idea why this is, as I have entered a For, which is bolded, and when I take the Next Count away it says "For Without Next." Again, here is the code:

Private Sub CmdCheck_Click()
Dim Count As Integer, Middle As Integer, Found As Boolean, FirstLocation As Integer, Passes As Integer
Dim LastLocation As Integer, Pointer As Integer, Winnings As Integer, List(6) As Variant, SearchKey As Integer
Winnings = 0
Passes = 0
For Count = 0 To 5
Found = False
Passes = Passes + 1
FirstLocation = 0
LastLocation = 5
SearchKey = yournumbers(Count)
Pointer = (FirstLocation + LastLocation) / 2
If List(Pointer) < SearchKey Then
FirstLocation = Pointer + 1
LastLocation = Pointer - 1
End If
If List(Pointer) = SearchKey Then
Found = True
Winnings = Winnings + 1
End If
Next Count
Loop Until Passes > 4
Select Case Winnings
Case 0
PicWinnings.Print "Sorry, you have not won anything this time."
Case 1
PicWinnings.Print "You have won £10!"
Case 2
PicWinnings.Print "You have won £100!"
Case 3
PicWinnings.Print "You have won £1000!"
Case 4
PicWinnings.Print "You have won £10000!"
Case 5
PicWinnings.Print "You have won £100000!"
Case 6
PicWinnings.Print "You have won the jackpot of £1000000!"
End Select
End Sub

I've bolded the For and Next statements.

I also don't know if a binary search is the best way to go with this, if its not then could anyone suggest any alternatives?

Sorry for what must seem like really stupid questions, I am very much a noob to this stuff.

Again, thanks in advanced for any help you can give. I would ask my teacher but my school's on break and this has to be done for when we go back, plus I figure I've already gotten great help from you guys, so why not just ask again?

Wrong Number Of Arguments Or Invalid Property Assignment
I sent out about 600 disc and have run into this problem about 3 times with XP and I am baffled.  When my agents load this software on their XP boxes, the installation works fine.  When they try to start the software they are getting this run-time error in the subject line.  "Wrong number of arguments..."  I don't understand it and am having troubles fixing it because it has only happend on 3 of 600 and they were all XP.  I cannot recreate it in my model office environment so I don't know where to begin to fix it.  Is there a patch for XP?  Anyone have any insight on this error?

About Error 450: Wrong Number Of Arguments Or Invalid Property Assignment
What I did was simply to change date 'MMM-YY' based on user inputs. The code goes like this:

Sub ChngMonth()
MMMYY = InputBox("Enter The Last Data Month (mmm-yy):")
If MMMYY = "" Then Exit Sub
ddmmmyy = "15-" & MMMYY
For i = 0 To 330 Step 30
j = 12 - i / 30
Worksheets("Monthlist").Cells(1, j) = "'" & format(CDate(ddmmmyy) - i, "mmm-yy")
End Sub

When I run it, I will have 450 for 'format()' statement. But the funny thing is I don't always get that error. For some workbooks, I do; the others, I don't. I guess it has something to do with the way the book was set up; or some options that I didn't select. If the problem is with "Wrong number of arguments", how come for some workbooks it works, some not, using the same statement.
Thanks in advance.

Rounding Error: Wrong Number Of Arguments Or Invalid Property Assignment
I am experimenting with a program that calculates compound interest. As you can see the balance is produced in a box for each year for 9 years. Now I want to have a button by each of those boxes so I can round the balance. Now when I click on the button to round I get an error saying "Wrong number of arguments or invalid property assignment." I have tried everthing I can think of to fix this but can't. Hoping one of you can check out some of my source and figure out whats wrong. Here are parts of the source that I think might be helpful:

f = Val(Interest.Text): P = Val(Principal.Text): z = 100: Dim B As Single
I = f / z
A = I * P
B = A + P
Year1.Text = CStr(B)
Private Sub Round_Click()
B = Round(B, 2)
End Sub

Compiler Error: Wrong Number Of Arguments Or Invalid Property Assignment
I am trying to call a C++ function from VB but I am getting an error when I
compile on VB6, the error is: Wrong number of arguments or invalid property
assignment, I am sure it has somethin to do with invalid property assignment,
if someone came across the same error, can you please help me.
Thank you very much in advance.
C++ fucntion in Dll is:
typedef DWORD far *LPDWORD;
typedef unsigned long DWORD;
EPP_API DWORD EppGetDGReadingTime( WORD dgIndex, LPDWORD time ){
*time = AnIntValue; //an int value is assigned to time reference
return STAT_SUCCESS; //STAT_SUCCESS type is long
and in VB I have: (note that the time is accually an int value)
Public Declare Function EppGetDGReadingTime Lib "CbnEppDll.dll" (ByVal
dgIndx As Integer, ByRef time As Integer) As Long
it is called in VB code as follows:

Dim dgIndx As Integer
Dim time As Integer
EppGetDGReadingTime(dgIndx, time)

Wrong Arguments Or Invalid Property Assignment
HI guys, I have the code:

Public Sub Add(ByVal strCustomerID As String, ByVal strLastName As String, _
ByVal strFirstName As String)

'Add a member to a collection

Dim NewCustomer As New CCustomer

With NewCustomer
.LastName = strLastName
.FirstName = strFirstName
.CustomerID = strCustomerID

mCustomers.Add NewCustomer, .CustomerID
End With

End Sub

Then I tried to add a customer by clicking an OK button

Private Sub cmdOK_Click()

'Choose action depending upon the action setting
Select Case mstrAction
Case "A"
'add to listbox
Dim strName As String
Dim strKey As String

strName = txtCustomerID.Text & "-" & txtLastName.Text & "," & txtFirstName.Text
With frmMain.lstCustomer
.AddItem strName
strKey = mCustomers.NextCustomerID
.ItemData(.NewIndex) = Val(strKey)
End With

'add customer object to collection, setting the key
mCustomers.Add txtLastName.Text, txtFirstName.Text, txtCustomerID.Text, strKey

End Select

End Sub

But I keep getting an error:

Changing Printers With Rundll32 - Error "Invalid Arguments"
Hello. I'm looking to:
Save the existing printer info into a file.
change the printer to a printer name passed into the system(PrinterDevName)
Finally change the printer back to the original printer utilizing the previously saved file.

The code to do this is below:


oldPrinter = Printer.DeviceName

Shell "rundll32 printui.dll,PrintUIEntry /Ss /n" & oldPrinter & "/a file.dat"

Shell "RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n" & Chr(34) & PrinterDevName & Chr(34)

Shell "rundll32 printui.dll,PrintUIEntry /Sr /n" & oldPrinter & Chr(34) & "/a file.dat"

The first and third shell call (to save the printer data to a file and then to use the printer data saved to the file) are returning "Invalid Argument" errors. Do you know why? What's wrong with the syntax?

Thank you!

"The Property 'SourceFile' Of File Blah Is Invalid" --- Visual Studio Installer
Ok, I have an EXE, which uses a DLL, which inturn uses another DLL...

UI ---> Objects ---> Server

Although ALL these components are to go on the client PC...
Now, all compiled fine, and all reference each other fone.
However, when I try and use VSI to create a setup package the SourceFile property for my server DLL is different to the others:

Other are:


BUT the server file is just simply:


Now when playing with VSI I did manage to get some error messages in the task list thing that said msado21.tlb could not be added to install. My server objects is the only tier to use ADO...could this be the cause?

I have 1hr and 56 mins to fix this problem!

I REALLY hope someone can help


Why Is This Giving Me An "Invalid Property Value" Error? [SOLVED]
VB Code:
Private Sub cmdPlay_Click()    MediaPlayer1.Volume = 0    MediaPlayer1.Open Path & "" & tvwSongs.SelectedItem    ProgressBar1.Max = MediaPlayer1.Duration    Timer1.Enabled = TrueEnd Sub

I tried using the Round function to round it off, but it still gives that error.

The Error Shows: "Invalid Property Value"

Why I am getting "invalid property value" while executing the following code? Please help me out. The code in bold was highlighted.

VB Code:
Public Sub cmdGetTotalCollections_Click() Dim i As Integer, CTotal As Double For i = 1 To lvwCollections.ListItems.Count [b]CTotal = CTotal + lvwCollections.ListItems.Item(i).SubItems(3)[/b]     Next i txtGetTotalCollections.Text = CTotaltxtGetTotalCollections.Text = Format(txtGetTotalCollections.Text, "##,##.00")End Sub


Listview Error "invalid Property Value" --
Ok another (simple) problem. The following code is giving me an error: "invalid property value".

What's wrong??

Thanks for your help...

- Jake

Private Sub SelectFixable_BTN_Click()
Dim sf_1 As Integer
MsgBox ("trying to select fixable")

If ListView1.ListItems.Count = 0 Then Exit Sub
For sf_1 = ListView1.ListItems.Count To 1 Step -1
MsgBox (ListView1.ListItems(sf_1).SubItems(10))
If ListView1.ListItems(sf_1).SubItems(10) = "Yes" Then
ListView1.ListItems.Item(sf_1).Selected = True
End If
Next sf_1

MsgBox ("Finished attempt to select fixable")
ListView1.HideSelection = False

End Sub

A Runtime Error "Invalid Property"

i try and run my app that relates to an access database through ADO and i get a message stating

Run-time error '380':

Invalid property value

The error occurs at " dtpStartDate.Value = rs.Fields("StartDate") " this is a datepicker

This is the whole Sub

Public Sub fillfields()
If Not (rs.BOF = True Or rs.EOF = True) Then 'Checks if we are at the first or last record. This is use a lot.
lblItemNumber.Caption = rs.Fields("ItemNumber")
lblHighestBidder.Caption = rs.Fields("HighestBidder")
dtpStartDate.Value = rs.Fields("StartDate")
dtpEndDate.Value = rs.Fields("EndDate")
txtFinalPrice.Text = rs.Fields("FinalPrice")
txtPostage.Text = rs.Fields("Postage")
txtPackaging.Text = rs.Fields("Packaging")
lblTotal.Caption = rs.Fields("Total")
txtExtraAmount.Text = rs.Fields("ExtraAmount")
rtbReason.Text = rs.Fields("Reason")
dtpReceivedMoneyDate.Value = rs.Fields("ReceivedMoneyDate")
lblReceivedMoneyType.Caption = rs.Fields("ReceivedMoneyType")
dtpSentItemDate.Value = rs.Fields("SentItemDate")
dtpReceivedItemDate.Value = rs.Fields("ReceivedItemDate")

MsgBox "Either you are at the first record or the last record.", vbExclamation, "Cannot Move"
End If
End Sub

Does anyone know what the problem could be???


Data Base "Invalid Property Value"
I am using vb6, sp5 and jet engine (DAO).  The app works fine on the development machine but when installed on a client computer I get Error 380,"Invalid Property Value" at the point at which it is accessing a NULL field.  It even happens if I use IF ISNULL(DB!FIELD) THEN...

It seems that I might be missing a program component.  

Any suggestions would be welcome.

Thanks,     David Abineri


"Invalid Use Of Property" With An Object....
VB Code:
set TempCust = New clsCustomerset TempCust.FirstName = txtFirstName.Text

for some reason this is giving me an error.... i thought i had classes sorted but evidently not...

TempCust is dim-ed in a module to make it global, it needs to be accessed between forms

all the properties of clsCustomer are public (yeah, its bad, so bite me)

whats wrong?

Message "Invalid Property Value"
The problem is that I don't know how to "restart" the ComboBox object:

1. I added values to it.
2. At the beginning the value (text that it shows) is empty.
3. I chose some value
4. Now I'd like to make again empty:
for example, I write something like this:

ComboBox1.ListIndex = -1
ComboBox1.Value = ""
'and here I am adding the values again

But the problem is that when I want to choose another object in the form I cannot because of the error message:

Invalid property value


"CodeLocation" Property Returns Wrong Value
I'm having problems with the CodeLocation property in the VB IDE Extensibility model. The value returned (supposed to be the line number of the Sub/Func/... within the code module) is consistently wrong. Example code follows: -


Private mobjVBInstance As VBIDE.VBE
Private mobjCodePane As VBIDE.CodePane
Private mobjCodeModule As VBIDE.CodeModule
Private mobjMember As VBIDE.Member

Set mobjVBInstance = VBInstance
Set mobjCodePane = mobjVBInstance.ActiveCodePane
Set mobjCodeModule = mobjCodePane.CodeModule

For Each mobjMember In mobjCodeModule.Members
If mobjMember.Type = vbext_mt_Method _
Or mobjMember.Type = vbext_mt_Event Then
Debug.Print mobjMember.Name & " " & mobjMember.CodeLocation
End If
Next mobjMember

Anyone had a similar problem?

Nick Michell.

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 .

Edward Hui

""The Given Assembly Name Or Codebase, 'Microsoft.WindowsCE.Forms', Was Invalid.""
Has anyone seen this error or Know what to do with it?
I have the program almost finished.When I deploy it to my pocket pc, everything is fine but when i try to install from the exe that I compiled it has this error.
then goes into debugging mode.
""The given assembly name or codebase, 'Microsoft.WindowsCE.Forms', was invalid

Edited by - Fredd on 11/17/2003 4:54:01 PM

What Does "Invalid Property Value" Mean?
Hi everybody,

I'm falling all over an "Invalid Property Value" error.

What does that mean?


"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

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

Changing The "value" Property Causes A "click" Event
Is there any way to make it so that when I change the "Value" property of a textBox or CheckBox or whatever, it doesn't fire a "Click" event? I'm having problems because when I change it, it then tries to do an update, thinking the user clicked it.

Easy Way To Create "AA" "BA" "CA"... From A Number?
Hello All,

Looking for an easy way to convert the number 27 into column AA, 52 int "AZ" etc. (I think thats right! for 52 ...)

Or, is there anyway I just use (3,3) for "C3"?

appExcel.Range( ??? ).Value = SomeDataInArray

This has GOT to be easy, I just can't find reference, and I didn't want to hard code it if I don't have to.


Solution&gt; 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?


"How To Pass Command Line Arguments To A Win32 Application"

I would like to pass the Command line arguments to my applications. How can it be possible!

thanks in adv.

How To Toss An Error Message For An Invalid ActiveX Control Property Assignment?
Hi, there
I am working on an VB activeX control. In the "Let" functions of my control's properties, I'd like to report those invalid assignment. For example, if the user assigned a negative value to a property which only accepts positive value, I would like VB to pop up a message box with a red cross in it and carries the error message defined by me. I know how to achieve it with ATL control, but I don't know how with VB activeX control. Please advise and thanks in advance...

ADO Recordset's Filter Property(Usage Of "Is Null" And "Is Not Null")
Hi, Gurus!

IS NOT NULL and IS NULL aren't in the list of allowed operators for the Filter property.
Is it ok to use LIKE '%' instead of IS NOT NULL and what can we use instead of IS NULL?

<Edit> Removed previous question, which was wrong. </Edit>

Making mistakes is one of the ways of improvement.
GL and HF

Edited by - un5killed on 3/26/2007 2:22:19 AM

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

Registry - Command-line Arguments (like "%1")
Anyone know where to find documentation on those "%" options for executable command entries (e.g. open/command) in the registry (and in Shortcut links)?

e.g. c:Program FilesMyStuffMyProgarm.exe %1

I know about "%1" but I'd like to know what others are available - e.g. I've seen %L used in other commands in the registry.

I've searched MSDN with no success..... probably because I can't think of the right keywords....

Dr Memory

I'm Trying To Use A Procedure With To Arguments. But There Is An Error: "expected: ="
I'm writting exactly following code

Sub Multiply(x as Integer, y as Integer)
????1.CommandButton1.Caption = x * y
End Sub

In the required place I write:
Multiply (5, 6)

And the result - ERROR

What should I do? Or it is impossible to use procedure with to arguments in VBA???

How To Replace "Apple" With "Banana" In A String That Contains "Orange" In A TXT File
Whoa! Long thread title. Basically, how can I search for any string in a text file that contains "Orange", then replace "Apple" with "Banana" in that same string? Is this difficult? Thanks!

Data1.RecordSource = "select * From Salary Where &#22995;&#21517; Like " + S + " " * ""
Data1.RecordSource = "select * from salary where 姓名 like " + s + " " * ""
thanks in advance gentlemen and ladies..
firstly...I don't know what must add "++" between "s " variant..
who can tell me why?? thanks , ,, I really don't know why it does this..
maybe i am a beginner..please forgive me why add ++ between s..thanks

How To Change Boolean Field From Displaying "0" And "-1" To "Yes" And "No"
Hey there,

I have a data report, which displays a few fields from an Access table, one which is a boolean. At the moment if the boolean value is True, then on the data report it displays "-1", and if False "0".

How can I change this so it displays "Yes" if true and "No" if False?

Would be really grateful for any help.

Correctly Save Image To Solve "Invalid Picture" Problem
Hello everybody,

I'm having trouble in a system I'm working on. I receive some images from a customer in a different format (SGD extension, created by the customer). I want to load this image in a PictureBox to resize them, but I get a "Invalid Picture" error. I've tested and checked that if I enter Ms Paint and re-save the image as JPG (instead of renaming it, as I was doing) the error will not occur. So, what I need to do is resave it programatically.

Does anybody know how to do it?


Correctly Save Image To Solve "Invalid Picture" Problem
Hello everybody,

I'm having trouble in a system I'm working on. I receive some images from a customer in a different format (SGD extension, created by the customer). I want to load this image in a PictureBox to resize them, but I get a "Invalid Picture" error. I've tested and checked that if I enter Ms Paint and re-save the image as JPG (instead of renaming it, as I was doing) the error will not occur. So, what I need to do is resave it programatically.

Does anybody know how to do it?


"Invalid Qualifier" Error When Passing String Param To Function
-Compile Error: Invalid Qualifier

Hi All
I have written a simple function to populate various combo boxes in my application. The comboboxes are on various seperate forms so i decided to create the function as a public function and i wrote it in a global.bas module (not sure if this was the right thing to do so let me know if you think this should be changed)

Anyway the main problem is that when I pass the combobox_name to the function e.g. "Form1.cboBranchName" i get the invalid qualifier error

For info the sStoredProcName string parameter seems to pass without problem

P.s. My Vb knoweldge is very rusty and isnt great to begin with so please can you break it down a simply as u can, and feel free to point out any other glaring errors


The called function
Public Function PopulateComboBoxes(sStoredProcName As String, sComboBox As String, intCol As Integer, bNotSpecified As Boolean)

Dim sqlcon3 As New adodb.Connection
Dim Rs3 As New adodb.Recordset
Dim temp1 As Variant
Dim sqlstr As String
Dim i As Integer

sqlcon3.Open "Provider=sqloledb;data source=szs005;initial catalog=CallLog;", "shoezone", "property"

With Rs3
    .CursorType = adOpenDynamic
    .CursorLocation = adUseClient
    .LockType = adLockOptimistic
End With

Set Rs3 = sqlcon3.Execute(sStoredProcName)

Do While Not Rs3.EOF
    sComboBox.AddItem Rs3.Fields(intCol).Value
    sComboBox.ItemData(sComboBox.NewIndex) = Rs3.Fields _(intCol).Value

sComboBox.Text = sComboBox.List(0)

End Function

The Calling function
Private Sub PopulateFilterBys()

'Get Branch List
Call PopulateComboBoxes("Exec branch", "Form1.cboBranch", 0, True)

End Sub

CDOSYS CreateMHTMLBody Returns Error "Invalid Syntax"

I have been using CDOSYS, on windows 2003 server having office 2003 installed.
CreateMHTMLBody of CDO.message is failing for some urls like "" & "" while working just fine for others.

Any help is really appreciated on this issue.

CreateMHTMLBody returns "Invalid syntax" with error no. "-2147221020 ".

Thanks in advance.

Why This "35610 Invalid Object" Violation In Highlighted Line
Hi everybody,

The following code ought to fill a TreeView with Parent, Child and GrandChild nodes but fails (on the highlighted line) with a "Run Time Error 35610". Other than refering to an Invalid Object there isn't a suggestion about which object is being offended, or why.

Can someone help me?

Private Sub FillExpenseTree()
tvExpenses.Nodes.Add , , "Expense", "Expense"
tvExpenses.Nodes(1).Bold = True
tvExpenses.Nodes(1).Expanded = True
tvExpenses.Nodes(1).ForeColor = vbBlue
sSql = "SELECT acct_title, acct_title_id FROM tbl_acct_title WHERE acct_head_id = 2 ;"
Set rsData1 = New ADODB.Recordset
Set rsData1 = cnDB.Execute(sSql)
While rsData1.EOF = False
tvExpenses.Nodes.Add "Expense", tvwChild, , rsData1.Fields(1) & ".." & rsData1.Fields(0)
sSql = "SELECT * FROM tbl_acct_list WHERE acct_head_id =2 ;"
Set rsData2 = New ADODB.Recordset
Set rsData2 = cnDB.Execute(sSql)
Do While Not rsData1.EOF
While rsData2.EOF = False
tvExpenses.Nodes.Add rsData1!Acct_title, tvwChild, rsData2!acct_list, rsData2!acct_list
End Sub



Can't Make Listview Item In Bold As "Invalid Key" Error
I have a list of items in Listview. How to take an action if I double click an item in that Listview. For eg, I want an another form to load when I click a particular item? Thanks.

CDOSYS CreateMHTMLBody Returns Error "Invalid Syntax"

I have been using CDOSYS, on windows 2003 server having office 2003 installed.
CreateMHTMLBody of CDO.message is failing for some urls like "" & "" while working just fine for others.

Any help is really appreciated on this issue.

CreateMHTMLBody returns "Invalid syntax" with error no. "-2147221020 ".

Thanks in advance.

HELP! "Win32Api Caused And Invalid Page Fault In Kernel32.dll..."
Ok. Here's my problem. If I have my computer on for about half a day, it starts to freeze for very short periods of time randomly. My clock in the corner starts getting behind (Right now it's 1:54, and the clock on the screen says 1:33)

I'm running win 98.

Ok, here's the main problem. After a while, this box pops up titled "Win32api" and says "This program has performed an illegal operation...blah blah blah..." This box stays on top over any window I have open, so I have to move it down to a corner to continue working. If I close it, my system freezes and I have to shut it down manually and wait for teh scan disk thing on start up and all that crap.

Here's what the details show on the error box:

WIN32API caused an invalid page fault in
module KERNEL32.DLL at 0167:bff7a4b2.
EAX=00000000 CS=0167 EIP=bff7a4b2 EFLGS=00010206
EBX=00000000 SS=016f ESP=0064f2e4 EBP=0064f2f4
ECX=00420018 DS=016f ESI=00420000 FS=241f
EDX=0000007c ES=016f EDI=0042000c GS=0000
Bytes at CS:EIP:
8b 03 25 fc ff ff 0f 3b 45 0c 0f 83 81 00 00 00
Stack dump:
00000078 bff76ec4 0000000b 0064f424 0064f308 bff88dc4 00420000 0000007c 00000000 00000000 7fc0b9af 00420000 00000000 00000078 0041001c ffffffff

Some of that at the bottom looks like color coding for HTML, but I can't imagine my browser (IE 5) causing this.

Any help would be greatly appreciated.


Data Report Error "Closed Or Invalid Connection"
I am using the Data environment with the Data Report.

My reports run fine the first time, but if the user attempts to run them again, I get the error "Operation is not allowed on an object referencing a closed or invalid connection."

I don't completely understand the correct way to open, close or set the connection the the data environement, or the reports. Here is my code, which works once, but I need to be able to run the reports multiple times. Thanks in advance for any help.

The error occurs when trying to open the rscomHourlyRpt


DtaReports.CnnReports.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=pdp.mdb;Persist Security Info=false"

If DtaReports.CnnReports.State = 0 then
MsgBox "Reports failed to initialize. Please try again."
Exit Sub
End If
on error resume next
on error GoTo 0

fraPrinting(0).Visible = true

''''Hourly Employee Report
SQL$ = ""
SQL$ = SQL$ & "VAL(RegHrs) * .01 as RegHrs,"
SQL$ = SQL$ & "VAL(OvtHrs) * .01 as OvtHrs,"
SQL$ = SQL$ & "VAL(dblHrs) * .01 as DblHrs,"
SQL$ = SQL$ & "VAL(reg2Hrs) * .01 as Reg2Hrs,"
SQL$ = SQL$ & "VAL(Reg3Hrs) * .01 as Reg3Hrs,"
SQL$ = SQL$ & "VAL(Ovt2Hrs) * .01 as Ovt2Hrs,"
SQL$ = SQL$ & "VAL(Ovt3Hrs) * .01 as Ovt3Hrs,"
SQL$ = SQL$ & "VAL(Oth1Ern) * .01 as Oth1Ern,"
SQL$ = SQL$ & "VAL(SickHrs) * .01 as SickHrs,"
SQL$ = SQL$ & "VAL(VacHrs) * .01 as VacHrs,"
SQL$ = SQL$ & "VAL(HolHrs) * .01 as HolHrs,"
SQL$ = SQL$ & "VAL(CommErn) * .01 as CommErn,"
SQL$ = SQL$ & "VAL(Meals) * .01 as Meals,"
SQL$ = SQL$ & "VAL(Tips) * .01 as Tips,"
SQL$ = SQL$ & "VAL(MiscHrs) * .01 as MiscHrs,"
SQL$ = SQL$ & "VAL(Oth2Ern) * .01 as Oth2Ern,"
SQL$ = SQL$ & "VAL(AdjToNet) * .01 as Adj,"
SQL$ = SQL$ & "Cdiv,cDept FROM Query2 "

If PR.PAGEORDER = 5 And ManPage% = 0 then
frmBalanceMenu.KeyPreview = false
fraPaging(0).Visible = true
txtPaging.Text = ""
Exit Sub
End If

If PR.PAGEORDER = 1 Or ManPage% = 1 then
GoTo Choose
End If
If PR.PAGEORDER = 2 Or ManPage% = 2 then
GoTo Choose
End If
If PR.PAGEORDER = 3 Or ManPage% = 3 then
Debug.print SQL$

GoTo Choose
End If
If PR.PAGEORDER = 4 Or ManPage% = 4 then
SQL$ = SQL$ & "ORDER BY cDiv,cDept,LName, FSTName ASC"
GoTo Choose
End If
MsgBox "Paging Order error. set Paging order in Param File"
Exit Sub

on error resume next
on error GoTo 0

DtaReports.rscomHourlyRpt.Open SQL$ ''error occurs
RptHourly.Orientation = rptOrientLandscape

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?

"Invalid Field Data Type." When Converting To Prior Version Of MS Access.
I'm developing a website that uses a MS Access database. I'm creating the database in Access 2000, but the web server can only open Access 97 databases. I've been using the "Convert Database -> To prior Access Version" for the web server to use, and it's been working fine.

I just added a new table to the database containing the following fields:

ID - AutoNumber, Long Integer, Autoincrement, Primary Key, Not required, Indexed (No duplicates)
paragragh - Memo, Not required, Zero length allowed, Unicode Compression
picture - Text, Max 50, Not required, Zero length allowed, Not indexed, Unicode Compression
picturealignment - Text, Max 5, Not required, Zero length allowed, Not indexed, Unicode Compression
fonttags - Text, Max 100, Not required, Zero length allowed, Not indexed, Unicode Compression

Now when I try to convert it to an Access 97 database I get a

"Invalid field data type."

first, followed by

"Some errors happened during the conversion. No converted database is generated."

Can anyone help me?

"Invalid Operation" Setting Field Attributes

I receive error "Invalid Operation" while trying to change the Attributes property of a field in DAO 3.6.

I don't think I have to post the code, because I just wrote a small dummy program with six lines or so to open the database, open the table, and set the attribute of a field. I received this same error. First I tried with TableDef object, then with Recordset, but to no avail.

Just in case it matters, I am trying to set field Attributes to 1 + dbAutoIncrField, which equals 17.

The XML from which I set the property is as follows (I am writing a part of program that will allow to restore/update the database from its saved XML definition):

<property name="Attributes" type="dbLong">17</property>
This is also automatically generated by my program, so it is truthful.

Copyright © 2005-08, All rights reserved