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




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.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Compile Error: ByRef Argument Type Mismatch
not sure why I'm getting this error but here is my code:


VB Code:
Private Sub Command1_Click()Dim length As LongDim height As LongDim thickness As LongDim weight As LongDim price As Currency count1 = 0        length = InputBox("Input the length")    height = InputBox("Input the height")    thickness = InputBox("Input the thickness")    weight = InputBox("Input the weight") Do While count1 <= 5Call totalcost(length, height, thickness, weight, price)count1 = count1 + 1List1.AddItem (price)Loop   End Sub


it highlights Private Sub Command1_Click()
and Call totalcost(length, height, thickness, weight, price)

I have no clue why, please help me if you can.

Thanks

Compile Error: Byref Argument Type Mismatch
Ok, I have created a function that will tell you if a point is in a rectangle. The data I am passing is three longs and a user-defined type 'point'.


VB Code:
Public type Point      X as long      Y as longend type  public function PtinRect (byref recttopleft as point, spot as point, width as long, height as long)end function


when I try to call the function I get the error above. I tried byval earlier but of course that isn't allowed. Any ideas?

ByRef Argument Type Mismatch Error
I got the following error:

compile error:
ByRef argument type mismatch

here is where all the fuss is starting.
the exact point is this part:
(Triangle_Vertical_Length(OPoint, StartPoint, EndPoint)) < 5 Then

Code:
Public Function Collaision_Check(vector As Line) As Boolean
Dim i As Integer
Dim StartPoint, EndPoint, OPoint As point_type

StartPoint.X = vector.X1
StartPoint.Y = vector.Y1
EndPoint.X = vector.X2
EndPoint.Y = vector.Y2

Collaision_Check = False
For i = 0 To Char.UBound
OPoint.X = Mvalue(Char(i))
OPoint.Y = Nvalue(Char(i))
If (i <> Init_pointer) And _
(Triangle_Vertical_Length(OPoint, StartPoint, EndPoint)) < 5 Then
Collaision_Check = True
Exit Function
End If
Next i
End Function
as for the function it calls. here it is:


Code:
Public Function Triangle_Vertical_Length(HeadPoint As point_type, point2 As point_type, point3 As point_type) As Integer
Dim X1, X2, X3, Y1, Y2, Y3, RealSize As Integer
X1 = HeadPoint.X
Y1 = HeadPoint.Y
X2 = point2.X
Y2 = point2.Y
X3 = point3.X
Y3 = point3.Y
RealSize = Sqr((X1 - X2) ^ 2 + (Y1 - Y2) ^ 2 + (X2 ^ 2 + Y2 ^ 2 - X1 * X2 - Y1 * Y2 + X1 * X3 + Y1 * Y3 - X2 * X3 - Y2 * Y3) / Sqr((X2 - X3) ^ 2 + (Y2 - Y3) ^ 2))
Triangle_Vertical_Length = RealSize / FeetPixel
End Function

I cant see any types mismatch so I'm abit confused. What's the problem and how should I fix it?

ByRef Argument Type Mismatch Error
Ok, two lame questions in one night

I am attempting to send 3 integer variables to a function which is defined as follows:


Code:
Function TConvert(Min As Integer, Sec As Integer, BPM As Integer) As String

The variables to be sent to this function are indeed integers. However, when I pass them to this function I get a 'ByRef argument type mismatch error'.

The part of the code that causes the error:

Code:
Temp() = Split(txtTime.Text, ":")
TMin = CInt(Temp(0))
TSec = CInt(Temp(1))
BPM = CInt(txtBPM.Text)
txtMeasures.Text = TConvert(TMin, TSec, TBPM)

Any ideas? Thanks

Error Msg ByRef Argument Type Mismatch
I can't, find what is wrong. I tried to put ByRef anywhere without results. Help !


VB Code:
Private Sub piev_Click()   Call Picture1_MouseDown([color=DarkOrange]Button[/color], Shift, Xx, Yy)End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, Xx As Single, Yy As Single)               Text1.Text = CLatitude(Xx)    Text2.Text = CLongitude(Yy)    Picture1.AutoRedraw = 1    Call Picture1.PaintPicture(LoadPicture("c:f.jpg "), Xx, Yy)        Dim fn As Integer    fn = FreeFile    Open "C:data.txt" For Append As #fn    Print #fn, Xx & ";" & Yy    Close #fn   End Sub Function CLatitude(Xx As Single)  CLatitude = Xx * 1234End Function Function CLongitude(Yy As Single)    CLongitude = Yy * 1234End Function

ByRef Argument Type Mismatch Error --
I am just learning VB and am probably missing something simple. Can you tell me what it is?

The error comes in the CreateDIBSection section of the call. Specifically it does not like the "aBuch" variable.


VB Code:
Private Declare Function CreateDIBSection Lib "gdi32" (ByVal hdc As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, ByVal lplpVoid As Long, ByVal handle As Long, ByVal dw As Long) As Long 'here's the callPublic Sub PopulateListview(ByVal strFile As String, ByVal lvi As ListItems)         Dim hdcScreen        Dim hdcCompatible        Dim hBitmap        Dim hgdiobj        Dim aBuch As Long                hdcScreen = CreateDC("DISPLAY", Null, Null, Null)                hdcCompatible = CreateCompatibleDC(hdcScreen)                hBitmap CreateDIBSection(hdcCompatible, aBuch, Null, Null, Null, Null)                hgdiobj SelectObject(hdcCompatible, hgdiobj)                UINT GetDIBColorTable(hdcCompatible, , , RGBQUAD * pColors)End Sub


(BTW, I think the above is a total mess. If you could help clean it up you'd be a hero.)

Thanks for any help --

Jake

Error ByRef Argument Type Mismatch
When i run this code i get the above error.Can anyone please help.Upon the error the following code is highlighted:'val'

Code:
Dim Resp As String
Dim val, ArrayVal, FilterVal, CurValue, ValTrig, ClientResponse As String
MsgBox "Select * from vwClientAnswers where (Prompt1 in (" & Promptlist & ") AND ((Prompt2 in (" & Promptlist & ")) OR Prompt2 is null or Prompt2 = '') AND ((Prompt3 in (" & Promptlist & ")) OR Prompt3 is null or Prompt3 = '') AND (('" & TextInput & "' like '%' + Phrase1 + '%') OR Phrase1 is null or Phrase1 = '') OR (((Prompt1 is null) or (Prompt1 = '')) AND ('" & TextInput & "' like '%' + Phrase1 + '%'))) AND SectionID = " & SectionID

If SectionID = "" Then
JamesWiz.Play "Announce"
JamesWiz.Speak "You Have not selected a section"
'Exit Sub
Else
JamesWiz.SoundEffectsOn = True
JamesWiz.AutoPopupMenu = False
JamesWiz.Play "Think"
TextInput = Me.Text1.Text
TextInput = Replace(TextInput, "'", " ")

Set rs7 = objADOConn.Execute("Insert into tbLearnerentries (Learnerentry,Datelogged,LearnerID, InstanceID) Values ('" & TextInput & "','" & FormatDateTime(Now(), vbLongDate) & " " & FormatDateTime(Now(), vbLongTime) & "',1," & InstanceID & ")")
Set Rs = objADOConn.Execute("Select * from tbLearnerentries order by id desc")
LearnerEntryID = Rs("ID")
Promptlist = Replace(TextInput, "?", "")
Promptlist = ("'" & Replace(Trim(Promptlist), " ", "','") & "'")


Set rs8 = objADOConn.Execute("Select * from vwClientAnswers where (Prompt1 in (" & Promptlist & ") AND ((Prompt2 in (" & Promptlist & ")) OR Prompt2 is null or Prompt2 = '') AND ((Prompt3 in (" & Promptlist & ")) OR Prompt3 is null or Prompt3 = '') AND (('" & TextInput & "' like '%' + Phrase1 + '%') OR Phrase1 is null or Phrase1 = '') OR (((Prompt1 is null) or (Prompt1 = '')) AND ('" & TextInput & "' like '%' + Phrase1 + '%'))) AND SectionID = " & SectionID)

If Not rs8.EOF Then
    Set rs9 = objADOConn.Execute("Select InstanceID from vwRepeats where InstanceID = " & InstanceID & " AND ClientAnswerID = " & rs8("ID") & " And MayShow = 0")
    If rs9.EOF Then
    val = rs8("Answer")
    ArrayVal = split(val)
    FilterVal = Filter(ArrayVal, "<~")
        For i = 0 To UBound(ArrayVal)
            If Left(ArrayVal(i), 2) = "<~" Then
                CurValue = ArrayVal(i)
                CurValue = Replace(CurValue, "<~", "")
                CurValue = Replace(CurValue, "~>", "")
                Set rs10 = objADOConn.Execute("Select Value1,VarType, YN from vwInstanceVars where InstanceID = " & InstanceID & " and VarID = " & CurValue)
                If Not rs10.EOF Then
                    If rs10("VarType") = "bit" Then
                        If rs10("YN") = 1 Or rs10("YN") = True Then
                        ArrayVal(i) = "Yes"
                        Else
                        ArrayVal(i) = "No"
                        End If
                    Else
                    
                    ArrayVal(i) = rs10("Value1")
                    End If
                Else
                    ArrayVal(i) = ""
                End If
            End If
        Next
        ValTrig = Join(ArrayVal)
        ClientResponse = ValTrig
        ClientResponse = Replace(ClientResponse, "'", "''")
    Set rs11 = objADOConn.Execute("Insert into tbClientResponses (ClientAnswerID,ClientResponse,DateResponded,Learnerentryid,LearnerID, InstanceID, SectionID) Values (" & rs8("ID") & ",'" & ClientResponse & "','" & FormatDateTime(Now(), vbLongDate) & " " & FormatDateTime(Now(), vbLongTime) & "'," & LearnerEntryID & ",1," & InstanceID & "," & SectionID & ")")
    'CheckforTrigger (rs8("ID"))
    Set rs14 = objADOConn.Execute("SELECT * FROM tbClientResponses Where LearnerId = 1 And InstanceID = " & InstanceID & " order by ID desc")
    'Dim a
    'a = rs14("ClientResponse")
    'Resp = UnEscape(a)
    JamesWiz.Play "Acknowledge"
    JamesWiz.Speak rs14("ClientResponse")
    Else
    Set rs12 = objADOConn.Execute("Insert into tbClientResponses (ClientAnswerID,ClientResponse,DateResponded,Learnerentryid,LearnerID, InstanceID, SectionID) Values (0,'I think I have already told you.','" & FormatDateTime(Now(), vbLongDate) & " " & FormatDateTime(Now(), vbLongTime) & "'," & LearnerEntryID & ",1," & InstanceID & "," & SectionID & ")")
    'CheckforTrigger (0)
    Set rs15 = objADOConn.Execute("SELECT * FROM tbClientResponses Where LearnerId = 1 And InstanceID = " & InstanceID & " order by ID desc")
    JamesWiz.Play "Uncertain"
    JamesWiz.Speak rs15("ClientResponse")
        End If
    Else
    Set rs13 = objADOConn.Execute("Insert into tbClientResponses (ClientAnswerID,ClientResponse,DateResponded,Learnerentryid,LearnerID, InstanceID, SectionID) Values (0,'I am sorry, I do not understand - Could you please rephrase that?','" & FormatDateTime(Now(), vbLongDate) & " " & FormatDateTime(Now(), vbLongTime) & "'," & LearnerEntryID & ",1," & InstanceID & "," & SectionID & ")")
    Set rs16 = objADOConn.Execute("SELECT * FROM tbClientResponses Where LearnerId = 1 And InstanceID = " & InstanceID & " order by ID desc")
    JamesWiz.Play "DontRecognize"
    JamesWiz.Speak rs16("ClientResponse")
        If MsgBox("Did you mean something else?", vbInformation + vbYesNo, "Message") = vbYes Then
    
        Else
            JamesWiz.Speak "Please enter a answer for your question, so that I'll remember next time.You can also add variables to your answer"
            Frame3.Visible = True
        End If
    End If
End If
'objADOConn.Close


vikramjb : Added Code Tags For Better Readbility



Edited by - vikramjb on 11/22/2005 12:29:31 AM

ByRef Argument Type Mismatch, What Is Wrong With This Little Piece Of Code
Hi,
i can't figure out why i get this error..
All seems fine, i used this code before..
well here it is:


Code:
Dim Inum As Integer
Nget IniLine, "Num", Inum 'i'll explain this down


i use this function to get stuff out of my ini file..
it suppose to get 'Num' from IniLine.
'Num' in the ini file is '6'.
Normaly i would get that Inum = 6, but instead i get a ByRef error..

in the previus line i used the same code:


Code:
Dim Iname As String
Nget IniLine, "Name", Iname


and i got the value of Iname with no trubble..

why is that..??
anyone?
thanks...

ByRef Argument Type Mismatch
I get a byref argument type mismatch in my game, i dont know why, does anyone know how to fix it? its in the collisions section (always the stumbling block, collisions)

Thanks in advance

Minalth

ByRef Argument Type Mismatch
Im making a simple game with directx i probley made some very stupid mistake, what does this error mean? i get it for this:

Code:
For t = 0 To 480 Step 48
For s = 0 To 640 Step 64
N = N + 1
Stars(N) = CreateTLVertex(s, t, 0, 1, RGB(0, 0, 0), 0, 0, 0)
Next
Next
it highlights the s, thanx

Byref Argument Type Mismatch
I am trying to call sub but I get the byref argument type mismatch every time I call the Draw sub. Both arguments (send and received) are strings so I don't know why its doing it to me.
Any ideas? The code is below.

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdLoad_Click()

Dim strFilePath, strFileName As String

Dim strLinesFromFile, strNextLine As String
Dim FileIndex As Long

strFilePath = "C:Documents and SettingsAdminMy DocumentsJobsDecousticsCNCFiles"
strFileName = txtFile.Text

Open strFilePath & "" & strFileName For Input As #1

Do Until EOF(1)
Line Input #1, strNextLine
strLinesFromFile = strLinesFromFile + strNextLine + vbCrLf
Loop

Close #1

FileIndex = InStr(1, strLinesFromFile, "()", 1)
strLinesFromFile = Mid(strLinesFromFile, FileIndex + 3)

Call Draw(strLinesFromFile)

Open strFilePath & " est.txt" For Output As #2

Print #2, strLinesFromFile

Close #2

End Sub

Private Sub Draw(strCNCData As String)

Dim strWorkingData As String
Dim strCurrentCommand As String
Dim lngStringLength As Long
Dim intSpaceLocation As Integer

strWorkingData = strCNCData
lngStringLength = Len(strWorkingData)

intSpaceLocation = InStr(strWorkingData, vbCr)
strCurrentCommand = Left(strWorkingData, intSpaceLocation)
lngStringLength = lngStringLength - intSpaceLocation - 2
strWorkingData = Right(strWorkingData, lngStringLength)



End Sub

ByRef Argument Type Mismatch
Can anyone help me with the code below? I am getting a ByRef argument type mismatch error on the 'yy' variable. This *hopefully* will create an array with Sudoku numbers, if I ever get it working.

Thank you.


Code:
Option Base 1
Dim SArray(9, 9)
Private Sub Form_Load()
For yy = 1 To 9
For xx = 1 To 9
loopy:
Randomize Timer
rr = Int(Rnd * 9) + 1
If AllClear(xx, yy, rr) = True Then
SArray(xx, yy) = rr
Else
GoTo loopy
End If
Next xx
Next yy
Open App.Path & "myArray.txt" For Output As #1
For ya = 1 To 9
For xa = 1 To 9
Write #1, SArray(xa, ya);
Next xa
Write #1, ""
Next ya
Close #1
MsgBox "DONE!"
End Sub
Private Function AllClear(ByVal xx As Integer, yy As Integer, rr As Integer) As Boolean
AllClear = True
'Check Row
For x = 1 To 9
If SArray(x, yy) = rr Then
AllClear = False
End If
Next x
'Check Col
For y = 1 To 9
If SArray(xx, y) = rr Then
AllClear = False
End If
Next y
'Check Rest
Select Case xx
Case 1, 2, 3
Select Case yy
Case 1, 2, 3
CSect = 1
Case 4, 5, 6
CSect = 4
Case 7, 8, 9
CSect = 7
End Select
Case 4, 5, 6
Select Case yy
Case 1, 2, 3
CSect = 2
Case 4, 5, 6
CSect = 5
Case 7, 8, 9
CSect = 8
End Select
Case 7, 8, 9
Select Case yy
Case 1, 2, 3
CSect = 3
Case 4, 5, 6
CSect = 6
Case 7, 8, 9
CSect = 9
End Select
End Select
Select Case CSect
Case 1
sx = 1: ex = 3
sy = 1: ey = 3
Case 2
sx = 4: ex = 6
sy = 1: ey = 3
Case 3
sx = 7: ex = 9
sy = 1: ey = 3
Case 4
sx = 1: ex = 3
sy = 4: ey = 6
Case 5
sx = 4: ex = 6
sy = 4: ey = 6
Case 6
sx = 7: ex = 9
sy = 4: ey = 6
Case 7
sx = 1: ex = 3
sy = 7: ey = 9
Case 8
sx = 4: ex = 6
sy = 7: ey = 9
Case 9
sx = 7: ex = 9
sy = 7: ey = 9
End Select
For y = sy To ey
For x = sx To ex
If SArray(x, y) = rr Then
AllClear = False
End If
Next x
Next y
End Function

Byref Argument Type Mismatch
Hello,

I receive a "Byref argument type mismatch" error on this line of code:

Code:
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
v3 = X
v4 = Y
shootlaser v3, v4, 2 'Error occurs on this line
end sub

Sub shootlaser(vx As Long, vy As Long, wh As Long)
..
end sub 'is my shootlaser sub.
the line

Code:
shootlaser xx,yy,1
where xx and yy are values recieved through a winsock connection, works fine and the shootlaser sub functions (it draws a laser on screen)

Any ideas why calling the sub is not working in the MouseUp sub?

Byref Argument Type Mismatch
hello everyone,

I have a byref argument type mismatch, while trying to use a type I've defined myself in a function.


Option Explicit

Type Contact

title As String
firstName As String
surname As String
company As String
address As String
postCode As String
town As String
country As String
phoneNumber As String

End Type


sub blabla()
.
.
.
Dim contact1, contact2 As Contact
.
.
.
If compareContacts(contact1, contact2) Then --> error here
.
.
.
end sub

Function compareContacts(ByRef contact1 As Contact, ByRef contact2 As Contact) As Boolean
.
.
.
end function

here are some parts of what I've done, the dimention are supposed to be the same, so what is it ? Do I need a function to get a pointer to the contact ?? Is it a problem that strings don't have a fixed size ?

of course, I could simply make a big string from my contact and then parse it to re-do the contact, but I'd like to know if there's another way before.

Thx in advance.

Byref Argument Type Mismatch - WHAT?
I'm having a silly problem. The following code gives me a "ByRef Argument type mismatch" at run time. What am I missing?


Code:
Private Sub DrawArrowHead(Source As Control)

Const PI As Double = 3.1415
Dim xA, xB, yA, yB As Single
Dim angle As Double
Dim Length, Breadth As Double

Length = Source.Y1 - Source.Y2
Breadth = Source.X2 - Source.X1

angle = atan2(Lenght, Breadth) 'this is the error line
xA = Source.X1 + 50 * (Cos(angle - (PI / 4)))
yxA = Source.Y1 + 50 * (Sin(angle - (PI / 4)))
xB = Source.X1 + 50 * (Cos(angle + (PI / 4)))
yB = Source.Y1 + 50 * (Sin(angle + (PI / 4)))

Form1.Line (xA, yA)-(xB, yB)
Form1.Line (xB, yB)-(Source.X2, Source.Y2)
Form1.Line (Source.X2, Source.Y2)-(xA, yA)

End Sub

atan2 is declared as

Code:
Private Function atan2(Y As Double, X As Double) As Double

ByRef Argument Type Mismatch
What causes this error? I'm trying to write a program using Call and functions. Would that mean i'm passing something wrong? help please

ByRef Argument Type Mismatch
y do i get the above error? the variable i declared is of date type and wot i'm passing is also of date type, and so is it in the function definition. the only thing i'm doing to the variable b 4 i pass it to the function is use fromdate=cdate(text1.text)

any ideas?

Byref Argument Type Mismatch
byref argument type mismatch ....
WHAT DOES THAT MEAN.. it happens ALL THE TIME!
i am going crazy! ok these are the scenarios when it happens.
i use a variable to chose a random number and use that same variable in a procedure call line ex:
r = int(rnd*7)-1
call Proc(r)

or here is another sample where i get this error:
this is just a sample ..
For X = 1 To 5
If X <> 1 Then
Do
RA = Int(Rnd * (12 - X))
RB = Int(Rnd * (12 - X))
UP = Int(Rnd + 0.5)
Call ChkCreate(X) '<---------------this is the eroneous line
If Go = True Then Exit Do

WHAT IS THIS ERROR AND HOW CAN I AVOID IT!?!? PLEASE HELP ME.. this error has been causing me lots of grief..

THANX in advance
-Raf

Byref Argument Type Mismatch
When I call a sub that I wrote I get an error "byref argument type mismatch". I do not want to specify byVal or byRef for everything. Why does this error even happen? I am just sending integers in. How can I avoid this? I fell like I am doing something wrong. It wants me to add a "ByVal" in front of every name in my function. I did a Google search, but did not find much advise. http://www.google.com/search?q=msdn+...en-US:official Thanks.

ByRef Argument Type Mismatch?
What does that error mean?

I have the following code, the commented line gets highlighted during the error:


Code:
Case "1001#": 'Look
For X = 0 To UBound(Player)
If Player(X).WinIndex = Index Then
X = User
End If
Next X
' Call Look(Index, User)

The Look Sub requires the Winsock index and what Player(#) They are...Why wouldn't this code work?

-Vinx

ByRef Argument Type Mismatch
I have the following code, which reads out a textfile, splits each line into parts, which are loaded in an array, then these parts are used to retrieve a line of the text file, and output the data into a form. Sounds strange, maybe it is, but first, the code:

The textfile for texting:

Code:
2.0.0.0.0;;0.0.0.0.0;;0.0.0.0.0;; (1) Het Gebouw
2.1.0.0.0;;2.2.0.0.0;;3.0.0.0.0;;Vraag of dit hoofdstuk van toepassing is
2.2.0.0.0;;0.0.0.0.0;;0.0.0.0.0;; (2) Elk Gebouw
2.2.1.0.0;;2.2.2.0.0;;2.3.0.0.0;;Vraag of deze sub wel van toepassing is
2.2.2.0.0;;0.0.0.0.0;;0.0.0.0.0;; (3) De hoofdvraag
2.2.2.1.0;;2.2.2.2.0;;2.2.3.0.0;;De vraag in dit geval, of wel of niet van toepassing
2.2.2.2.0;;0.0.0.0.0;;0.0.0.0.0;; (4) Het werk vindt plaats op een vaste locatie in een gebouw.
2.2.2.2.1;;2.2.2.2.2;;2.2.2.3.0;;De vraag in dit geval, of wel of niet van toepassing
2.2.2.2.2;;2.2.2.2.3;;2.2.2.2.3;; (a) Het werk vindt plaats op een vaste locatie in een gebouw.
2.2.2.2.3;;2.2.2.2.4;;2.2.2.2.4;; (b) Het gebouw wordt goed onderhouden.
2.2.2.2.4;;2.2.2.2.5;;2.2.2.2.5;; (c) Het interieur van het gebouw wordt goed schoongemaakt.



On the form, within the On Load part, this code is called uppon with the value 1 (so soort = 1)


Code:
Public Sub VragenLijstLaden(Soort As Integer)
' Hier het bestand openen en uitlezen
' Soort = checkboxnummer
' Vraagnummer is de opgevaagde vraag

' Het gebruik van soort doen we later om het bestand te vinden,
' voor nu is het even zaak om het uitlezen zelf te laten werken, met test.dat

Dim i As Integer
Dim max As Integer
Dim link As String

If Soort = 1 Then
link = glbRoot & "questions est.dat"
glbVragenLijstNaam = "MachineTEST1"
ElseIf Soort = 2 Then
link = glbRoot
glbVragenLijstNaam = "MachineTEST2"
End If

Open link For Input As #1
' max = EOF(1)
Close #1

max = 10

glbAantalregels = max
i = 0

Dim Array1() As String
Dim Array2() As String
ReDim Array1(max)
ReDim glbRegelsVar1(max)
ReDim glbRegelsVar2(max)
ReDim glbRegels(max)

Do While i < max

Open link For Input As #1 ' Open het bestand
Line Input #1, Array1(i) ' Read the line from the file
Close #1

Array2 = Split(Array1(i), ";")
glbRegelsVar1(i) = Array2(0) ' Voegt de vraagnummer aan global toe
glbRegelsVar2(i) = Array2(2) ' Dit is het ja antwoord
glbRegels(i) = Array2(6)

i = i + 1 ' 1 bij de i optellen.

Loop

Call RegelNummer(glbRegelsVar1(0)) ' Roep het eerste hoofdstukje op

End Sub

The value of glbRegelsVar1(0) should be the 2.0.0.0.0 of the text file. It however gives an error here. Wenn replace it with Call RegelNummer("2.0.0.0.0") it does work. The scripts work, i becomes 10, Array2(0 till 6) all have the correct values, however somehow I cannot add them into the array.

The globals are declared in a seperate module file, like this:

Code:
'Hier voor de Bedrijfsvragen weergave
Global glbVragenLijstNaam As String

Global glbRegels() As String
Global glbRegelVar1() As String
Global glbRegelVar2() As String
Global glbAantalregels As Integer

Global glbHoofdstuk As String
Global glbArtikel As String
Global glbHoofdgroep As String
Global glbSubgroep As String

ByRef Argument Type Mismatch
hi,
i know this kind of question has been posted here before but i still just cant understand what ByRef and ByVal means.. i keep getting this (the subject) error when running my code and i cant just see why

to describe my project
I am working on a taskbar project and I am almost finished except for some functions, among others the function to delete a 'button' on the taskbar. the function below works to an .ini file (configfile) and when a listitem on lstButtons is selected and the cmdDelete button is pressed the function Delete is run. The delete function removes the current settings for the selected button and restores the following buttons to take its place (ex if button 2 is deleted then button 3 and 4 becomes 2 and 3 in the ini-file)

after option explicit i declare:

Code:
Dim info1, info3, info4, info5 As String
Dim info2, i, max as Integer
Dim answer as Variant

Public Function delete()
answer = MsgBox("Are you sure you want to delete this button?", vbYesNo, "Delete button")
If answer = vbYes Then
ProfileSaveItem "Buttons Pressed", "cmdLink(" & lstButtons.ListIndex + 1 & ")", "", App.path & configfile
ProfileSaveItem "Buttons", "cmdLink(" & lstButtons.ListIndex + 1 & ")", "", App.path & configfile
ProfileSaveItem "Buttons Tooltip", "cmdLink(" & lstButtons.ListIndex + 1 & ")", "", App.path & configfile
ProfileSaveItem "Buttons Icon", "cmdLink(" & lstButtons.ListIndex + 1 & ")", "", App.path & configfile
ProfileSaveItem "Buttons Caption", "cmdLink(" & lstButtons.ListIndex + 1 & ")", "", App.path & configfile

max = Int(Screen.Height / 1000) 'Sets the maximum number of buttons to show due to screen height
i = 0 'Resets i
For i = lstButtons.ListIndex + 2 To max
info1 = ProfileGetItem("Buttons", "cmdLink(" & i & ")", "False", App.path & configfile)
If Not info1 = "False" Then '(False is the standard value)
ProfileSaveItem "Buttons", "cmdLink(" & i & ")", info1, App.path & configfile
End If

info2 = ProfileGetItem("Buttons Pressed", "cmdLink(" & i & ")", "False", App.path & configfile)
If Not info2 = "False" Then
ProfileSaveItem "Buttons Pressed", "cmdLink(" & i - 1 & ")", info2, App.path & configfile
End If

info3 = ProfileGetItem("Buttons Tooltip", "cmdLink(" & i & ")", "False", App.path & configfile)
If Not info3 = "False" Then
ProfileSaveItem "Buttons Tooltip", "cmdLink(" & i - 1 & ")", info3, App.path & configfile
End If

info4 = ProfileGetItem("Buttons Icon", "cmdLink(" & i & ")", "False", App.path & configfile)
If Not info4 = "False" Then
ProfileSaveItem "Buttons Icon", "cmdLink(" & i - 1 & ")", info4, App.path & configfile
End If

info5 = ProfileGetItem("Buttons Caption", "cmdLink(" & i & ")", "False", App.path & configfile)
If Not info5 = "False" Then
ProfileSaveItem "Buttons Caption", "cmdLink(" & i - 1 & ")", info5, App.path & configfile
End If

Next i
lstButtons.Clear
loadlist 'Reload the list (another function)
End If

End Function

The problem shows when doing the profilesaveitem at the infos, all of them. As these are strings it just makes me more confused with the ByRef.. maybe there is a very simple answer to this behaviour?

thanks
/llama!

ByRef Argument Type Mismatch -_-
Ok i keep getting that error ive been trying to fix it no sucess can any1 tell me why


Code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Command As String
Dim NewArrival As String
Dim Data As String
Static DataCnt As Long
Dim A As Variant
Dim i As Integer
Dim FirstData As String
Dim SecondData As String

Winsock1.GetData NewArrival$, vbString
DoEvents

FirstData = 1 'First Data Retrieve
SecondData = 2 'Second Data Retrieve

A = Parse(NewArrival$, "~")

rmsg.Text = rmsg.Text & A(FirstData) & A(SecondData) & vbNewLine
Call ColorText("Admin: ", vbRed)
Call ColorText(A(SecondData), vbBlue) < ERROR on A
End Sub

heres the functions involved

Private Sub ColorText(ByRef Word As String, ByRef Color As Long)
Dim lMrkr As Long
Dim sText As String
sText = rmsg.Text
lMrkr = InStr(sText, Word)
Do While lMrkr
rmsg.SelStart = lMrkr - 1
rmsg.SelLength = Len(Word)
rmsg.SelColor = Color
rmsg.SelBold = lMrkr
lMrkr = InStr(lMrkr + 1, sText, Word)
Loop
End Sub

Private Function Parse(sIn As String, sDel As String) As Variant
Dim i As Integer, x As Integer, s As Integer, t As Integer
i = 1: s = 1: t = 1: x = 1
ReDim tArr(1 To x) As Variant


If InStr(1, sIn, sDel) <> 0 Then


Do
ReDim Preserve tArr(1 To x) As Variant
tArr(i) = Mid(sIn, t, InStr(s, sIn, sDel) - t)
t = InStr(s, sIn, sDel) + Len(sDel)
s = t
If tArr(i) <> "" Then i = i + 1
x = x + 1
Loop Until InStr(s, sIn, sDel) = 0
ReDim Preserve tArr(1 To x) As Variant
tArr(i) = Mid(sIn, t, Len(sIn) - t + 1)
Else
tArr(1) = sIn
End If
Parse = tArr
End Function


it shows the error on the line i told u idk how to fix it

VB6 ByRef Argument Type Mismatch
Hi,

I am getting this error and can't work out why.
Can you please help.
The only difference is I have added .Fields("txtPPCR6080").Value in the below code. Without it works fine. and it highlights the mvarintUploadID for the error.

Thanks

df


Code:
If mvaroptNew = True Then 'If the user has elected to upload New Data
.MoveFirst
Do Until .EOF
If IsDate(.Fields("txtInitialDate").Value) = True And IsDate(.Fields("txtBatchDate").Value) = True Then
lngResult = InsertHoldingData(CDate(.Fields("txtBatchDate").Value), .Fields("txtBatch").Value, _
.Fields("txtURN").Value, .Fields("txtTitle").Value, Left(Trim(.Fields("txtInitial").Value), 1), .Fields("txtSurname").Value, _
.Fields("txtCompany").Value, .Fields("txtPOBox").Value, .Fields("txtAdd1").Value, _
.Fields("txtAdd2").Value, .Fields("txtAdd3").Value, .Fields("txtLocality").Value, .Fields("txtTown").Value, _
.Fields("txtCounty").Value, .Fields("txtPostcode").Value, .Fields("txtDPS").Value, _
.Fields("txtCountry").Value, .Fields("txtCountryCode").Value, _
.Fields("txtPhone").Value, .Fields("txtEmail").Value, IIf(Len(.Fields("txtBirthday").Value) < 1, Null, .Fields("txtBirthday").Value), _
.Fields("txtAgeRangeTo25").Value, .Fields("txtAgeRangeTo35").Value, _
.Fields("txtAgeRangeTo45").Value, .Fields("txtAgeRangeTo55").Value, .Fields("txtAgeRangeTo65").Value, .Fields("txtAgeRangeOver65").Value, _
.Fields("txtDiorUser").Value, .Fields("txtStoreCard").Value, .Fields("txtDNM").Value, .Fields("txtDNT").Value, .Fields("txtDNE").Value, .Fields("txtDNTP").Value, _
CDate(.Fields("txtInitialDate").Value), _
.Fields("txtDry").Value, .Fields("txtDehyd").Value, .Fields("txtFirstAge").Value, _
.Fields("txtVisible").Value, .Fields("txtLOFirm").Value, .Fields("txtRadiance").Value, .Fields("txtOily").Value, .Fields("txtPPB").Value, _
.Fields("txtPPAA").Value, .Fields("txtPPIOD").Value, .Fields("txtPPP").Value, .Fields("txtPPF").Value, .Fields("txtPPMU").Value, _
.Fields("txtPPFF").Value, .Fields("txtPPMF").Value, .Fields("txtPPC").Value, .Fields("txtPPNA").Value, .Fields("txtPPM").Value, _
.Fields("txtPPBI").Value, .Fields("txtPPBR").Value, .Fields("txtPPCR6080").Value, .Fields("txtValue").Value, .Fields("txtStoreNum").Value, _
0, mvarintUploadID, .Fields("HoldingID").Value _
)
DoEvents
frmImport.pbDataImport.Value = ((.AbsolutePosition / intRecCount) * 250) + 750
If lngResult = 0 Then UploadMainData = 0
.MoveNext
Else
DoEvents
frmImport.pbDataImport.Value = ((.AbsolutePosition / intRecCount) * 250) + 750
UploadMainData = 0
m_strLoadState = m_strLoadState & "Info: Insert Failed Holding in Rec: " & CLng(.Fields("HoldingID").Value) & vbCrLf
Call HoldingErrors(CLng(.Fields("HoldingID").Value), "Invalid Date", "New", 0)
.MoveNext
End If

ByRef Argument Type Mismatch
VB Code:
Public Type RGB    r As Byte    g As Byte    b As ByteEnd Type Public Function TestFunc(blah As RGB) As Boolean' example functionEnd Function 'usage:Call TestFunc(RGB(255,0,0)) ' errors ByRef argument type mismatch on RGB  

It errors ByRef argument type mismatch on RGB(255, 0, 0).

I've tried ByRef blah As RGB and ByVal blah As RGB also in TestFunc but doesn't make a difference.

ByRef Argument Type Mismatch
This doesn't work. I am terrible with functions

VB Code:
Public Function Squared(ByRef aNum As Long)     Squared = aNum * aNum End Function Private Sub Command1_Click()     Dim x As Integer     x = InputBox("Enter number you want squared")        MsgBox Squared(x) End Sub

ByRef Argument Type Mismatch
Guys

In my userform code I have this sub that calls upon another sub in the module part of the code. When I try to pass the required variables to that sub I get the error in the subject. I have declared the variables Public in the module part, and have declared the type in the sub itself like:

Sub subCalled(string1 As String, dbl As Double, int As Integer)
....
End Sub

I call that sub in the userform code like:

Call subCalled(string1, dbl, int)

I have tried declaring the variables again within the sub calling subCalled but that just doesn't make sense, in anycase it also doesn't work.

Anyone has any ideas on what I am doing wrong?

Cheers

ByRef Argument Type Mismatch
i am puting a scripting dictionary into a scripting dictionary....as shown here...

_____________________________________________
Dim scr, childscr As Scripting.Dictionary

Set scr = New Scripting.Dictionary
Set childscr = New Scripting.Dictionary

childscr.Add "PRICE", "999"
childscr.Add "DISCOUNTAMOUNT", "11"

scr.Add CStr("1"), childscr
var = SaveProduct(20, scr, "PRICE")
'HERE THE SaveProduct is a com function....on executing the SaveProduct the above error jumps up......
____________________________________

ByRef Type Mismatch Error. Help.
I have researched this and have used every troubleshooting procedure I know and can't get this to work. I am passing a textbox value (a number) into a variable then into a function. Add a number to the passed variable and return it to the form and into an output textbox. When the number is passed back to the output textbox I always get a ByRef error. Any help would be appreciated.

Option Compare Database

Private Sub Command5_Click()
txtInput.SetFocus
Dim strPass As Long
strPass = txtInput.Value
subTest (strPass)
txtOutput.SetFocus
txtOutput.Text = subTest(strSwap)<---- strSwap Error(won’t pass in variable, ByRef error)
End Sub


MODULE(Where function resides)

Public Function subTest(strSwap As Long) As Long
Dim sswap As Long
sswap = strSwap + 40
subTest = sswap

End Function

Error: ByRef Type Mismatch
What's wrong with my code. It has an error ByRef
Type Mismatch.

dim Servername() As Byte
dim grpusr as USER_INFO_2
dim user() As Byte
Dim num_entries As Long
Dim res
Dim h AS Long


Private Type GROUP_USERS_INFO_0
grui0_name As String
End Type

Private Declare Function NetUserSetGroups Lib "netapi32" _
(servername As Byte, _
username As Byte, _
ByVal level As Long, _
lpBuffer As Long, _
num_entries As Long) As Long

h = 0
grpusr.grui0_name = StrConv("Users" & Chr$(0), vbUnicode)
res = NetUserSetGroups(bServername(0), user(0), ByVal h, grpusr, num_entries) '-----This line gets an error

The more u read, the more u do not know

ByRef Argument Type Mismatch - WINEVENTPROC
To handle window events with SetWinEventHook function of Win32 API, I encountered "ByRef argument type mismatch" error on passing the parameter "pfnWinEventProc ", spent couple days in solving this error without good progress, below is simplified code with this error asking for your help.

What I am not sure is that I could not find any example for defining the type "WINEVENTPROC" of the parameter, therefore I converted it from the C lanaguage defined in "WinUser.h"


Code:
'VB code with "ByRef argument type mismatch"

Option Explicit

Public Declare Function SetWinEventHook Lib "user32.dll" (ByVal eventMin As Long, _
ByVal eventMax As Long, ByVal hmodWinEventProc As Long, ByRef pfnWinEventProc As WINEVENTPROC, _
ByVal idProcess As Long, ByVal idThread As Long, ByVal dwFlags As Long) As Long

Type WINEVENTPROC
hWinEventHook As Long
event As Long
hwnd As Long
idObject As Long
idChild As Long
idEventThread As Long
dwmsEventTime As Long
End Type

'Declaration for WinEvent
Const EVENT_CONSOLE_CARET = &H4001 '16385
Const EVENT_CONSOLE_END_APPLICATION = &H4007
Const WINEVENT_OUTOFCONTEXT = &H0 ' Events are ASYNC
Const WINEVENT_SKIPOWNPROCESS = &H2 ' Don't call back for events on installer's process

Public fMainForm As frmMain

Private Sub myWINEVENTPROC(hWinEventHook As Long, hWinEventHook As Long, WinEvent As Long, _
hwnd As Long, idObject As Long, idChild As Long, dwEventThread As Long, dwmsEventTime As Long)

End Sub

Sub Main()
hEventHook = SetWinEventHook(EVENT_CONSOLE_CARET, EVENT_CONSOLE_END_APPLICATION, 0&, _
AddressOf myWINEVENTPROC, 0, 0, WINEVENT_SKIPOWNPROCESS Or WINEVENT_OUTOFCONTEXT) 'Use our _
own module'Our callback function'All processes'All threads

End Sub

Code:
//Type "WINEVENTPROC" defined in C "WinUser.h"
typedef VOID (CALLBACK* WINEVENTPROC)(
HWINEVENTHOOK hWinEventHook,
DWORD event,
HWND hwnd,
LONG idObject,
LONG idChild,
DWORD idEventThread,
DWORD dwmsEventTime);
Thanks for your attention and any hint is appreciated.

ByRef Argument Type Mismatch? Cant Figure This Out!
ok i have this code to split a line of text into several parts and then it will send it to the apropiat form:


VB Code:
Dim authnr, tijdelijk, ipnummer, portnummer, sessionnr As String      sessionnr = Split(Split(ontvangendata, " ")(1), " ")(0)    ipnummer = Split(Split(ontvangendata, " ")(2), ":")(0)    portnummer = Split(Split(ontvangendata, ":")(1), " ")(0)    authnr = Split(Split(ontvangendata, " ")(4), " ")(0)    msnchatje.Show    msnchatje.maakverbindin ipnummer, portnummer, sessionnr, authnr


the form will get it like this

VB Code:
Public Sub maakverbindin(ipnummer As String, poort As String, session As String, athentic As String) sessionstr = session authstr = athentic msnWinsock.Connect ipnummer, poortEnd Sub

but i get this error:

Compile error:
ByRef argument type mismatch

I Cant Seem To Find The Problem (ByRef Argument Type Mismatch)
It could be that I'm no good with types,but I cant seem to find the problem.


VB Code:
Public Sub DrawArrows()'Start drawing arrowsDim ArrowXY(0) As StringFor I = LBound(DisplayTree()) To UBound(DisplayTree())    If DisplayTree(I).Pre <> "" Then        ReDim Preserve ArrowXY(ubound(GetReq(I))) As String 'Right here is where I get the error        ArrowXY() = GetReq(I)        For II = LBound(ArrowXY()) To UBound(ArrowXY())            Call ArrowTip(Form1.Img1(ArrowXY(II)).Left, Form1.Img1(ArrowXY(II)).Height, Form1.Img1(I).Left, Form1.Img1(I).Height)        Next II    End IfNext IEnd Sub   Public Function GetReq(ObjID As String) As String()'returns all of an objects requirmentsDim DisDef() As StringDim DisPre() As StringDim MyReturn(0) As String  DisPre() = Split(DisplayTree(ObjID).Pre, " ")For I = LBound(DisplayTree()) To UBound(DisplayTree())    ReDim DisDef(Split(DisplayTree(ObjID).Def, " ")) As String    DisDef() = Split(DisplayTree(ObjID).Def, " ")        For II = LBound(DisDef()) To UBound(DisDef())        For III = LBound(DisPre()) To UBound(DisPre())            If DisDef(II) = DisPre(III) Then 'found match, return index                MyReturn(UBound(MyReturn())) = I                ReDim Preserve MyReturn(UBound(MyReturn()) + 1) As String                Exit For            End If        Next III    Next IINext IReDim Preserve MyReturn(UBound(MyReturn()) - 1) As String  MsgBox (Join(MyReturn(), " "))'ReDim Preserve GetReq(UBound(MyReturn())) As StringGetReq() = MyReturn() End FunctionPublic Sub ArrowTip(x1, y1, x2, y2, Index)If Index <> 0 ThenLoad Form1.Lin1(Index)Load Form1.Lin1a(Index)Load Form1.Lin1b(Index)End If     p1 = 0: q2 = 1: p2 = Form1.Width: q1 = Form1.Height    arrow_length = 30   '0.01 * 1 * Form1.Width    beta = 30 * PI / 180    Form1.Lin1(Index).x1 = x1    Form1.Lin1(Index).y1 = y1    Form1.Lin1(Index).x2 = x2    Form1.Lin1(Index).y2 = y2    Dim salfa As Single, calfa As Single, vector As Single    Dim cth1 As Single, sth1 As Single    Dim cth2 As Single, sth2 As Single    Dim v1 As Single, w1 As Single, v2 As Single, w2 As Single    Dim xab1 As Single, yab1 As Single, xab2 As Single, yab2 As Single    Dim vab1 As Single, wab1 As Single, vab2 As Single, wab2 As Single    'Arrow's main line in "absolute" coordinates    xab1 = Form1.Width * (x1 - p1) / (p2 - p1)    yab1 = Form1.Height * (y1 - q1) / (q2 - q1)    xab2 = Form1.Width * (x2 - p1) / (p2 - p1)    yab2 = Form1.Height * (y2 - q1) / (q2 - q1)    'Length of the arrow's main body    vector = Sqr((xab2 - xab1) * (xab2 - xab1) + (yab2 - yab1) * (yab2 - yab1))    'Cos(alpha) and Sin(alpha):    calfa = (xab2 - xab1) / vector    salfa = (yab2 - yab1) / vector    'Sin & Cos of the angles between the 2 arrow tips and the x axis    'th1 = alpha - beta    'th2 = alpha + beta    cth1 = calfa * Cos(beta) + salfa * Sin(beta)    sth1 = salfa * Cos(beta) - calfa * Sin(beta)    cth2 = calfa * Cos(beta) - salfa * Sin(beta)    sth2 = salfa * Cos(beta) + calfa * Sin(beta)    'Arrow tips positions in "absolute" coordinates    vab1 = xab2 - arrow_length * cth1    wab1 = yab2 - arrow_length * sth1    vab2 = xab2 - arrow_length * cth2    wab2 = yab2 - arrow_length * sth2    'Back to user coordinates    v1 = p1 + vab1 * (p2 - p1) / Form1.Width    w1 = q1 + wab1 * (q2 - q1) / Form1.Height    v2 = p1 + vab2 * (p2 - p1) / Form1.Width    w2 = q1 + wab2 * (q2 - q1) / Form1.Height    Form1.Lin1a(Index).x1 = x2    Form1.Lin1a(Index).y1 = y2    Form1.Lin1a(Index).x2 = v1    Form1.Lin1a(Index).y2 = w1    Form1.Lin1b(Index).x1 = x2    Form1.Lin1b(Index).y1 = y2    Form1.Lin1b(Index).x2 = v2    Form1.Lin1b(Index).y2 = w2End Sub

RESOLVED: Question About A Sub, Byref Argument Type Mismatch?
im trying to do something that i though was going to be very simple, but im having a problem, it says "byref argument type mismatch" and highlights the "r" in:

c = LongToRGB(c, r, g, b)


VB Code:
Public Sub LongToRGB(ByVal lngColor As Long, intRed As Integer, intGreen As Integer, intBlue As Integer)    intRed = lngColor Mod &H100    lngColor = lngColor &H100    intGreen = lngColor Mod &H100    lngColor = lngColor &H100    intBlue = lngColor Mod &H100End Sub Dim c, r, g, b As Integerc = GetPixel(scrnimg.hdc, 25, 25)c = LongToRGB(c, r, g, b)

ByRef Argument Type Mismatch When Passing Variable [VB6]
Given the following code: If MatchF("Location", rArray(6)) Then Pass = False
Where: Public Function MatchF(strField As String, strValue As String)
This generates the following error “Compile Error: ByRef argument type mismatch”

Any clues as to why?
I tried the following code: If MatchF("Location", rArray(6).Value) Then Pass = False
This generates the following error: “Run-Time Error 424: Object Required”

All I want to do is pass that part of the Array into the MatchF function to determine if it is a match. The contents of Public Function MatchF should not make any difference nor should the contents @ rArray(6) itself.

ByRef Argument Type Mismatch &#8211; Outlook 2003 Why?
I am getting:
Quote:Compile error:
ByRed argument type mismatch
While my code is:Code:Sub kasza()
Dim mh, yr As Integer
mh = 1
yr = 1
directory = finddirectory(mh, yr)
End SubCode:Function finddirectory(m As Integer, y As Integer) As String
‘do stuff
End functionWhen I change this to:Code:directory = finddirectory(mh*1, yr*1)it works.
Can any one tell me why? And how to fix this?





Edited by - Geof on 3/16/2006 6:40:47 AM

Compile Error: Type Mismatch
I'm getting a Compile Error: Type Mismatch, in line 15 with the variable: strDtRet. Any suggestions?


Code:
Private Sub CreateFloatingCopy_Click()
On Error GoTo CreateFloatingCopy_Click_Err

Dim intcResponse As Integer
Dim strFileID As String
Dim strDwgNo As String
Dim strDtRet As String

intResponse = MsgBox("Do you want to create a floating copy of this document?", vbYesNo, "Create Floating Copy")
strFileID = Forms!DocumentControlPanel![DocumentMaster Subform].Form.FileID
strDwgNo = Table!FloatingCopy.Control("Drawing Number")
strDtRet = Table!FloatingCopy.Control("DateReturned")

If intResponse = vbYes Then
If strFileID = strDwgNo And strDtRet Is Null Then
MsgBox "Floating Copy already exists!" & Chr(13) & Chr(13) _
& "Current floating copy need to checked in before another can be created."
Else
DoCmd.OpenQuery "CreateFloatingCopyAppendQuery", acViewNormal, acEdit
End If
Else
MsgBox "Create Floating Copy Canceled!"
End If

CreateFloatingCopy_Click_Exit:
Exit Sub

CreateFloatingCopy_Click_Err:
MsgBox Error$
Resume CreateFloatingCopy_Click_Exit

End Sub

I Dont Know Why I Keep Getting Type Mismatch Compile Error For This Simple Command
i dont know why i keep getting type mismatch compile error with this command.

Code:


Private Sub CheckRotator()
If rotate = 0 Then
rotate = 1
Image1.Picture = App.Path & "clicktatorBrowser-clicktator.jpg"
Else
rotate = 0
Image1.Picture = App.Path & "clicktatorBrowser-clicktator_disabled.jpg"
End If
Exit Sub
End Sub




any sugestion?

What Is A &"ByRef Argument Type Mismatch&"?
I keep on getting this error in my script debugger . . . what does it mean? I am comparing strings in a variable and putting them into a string in another function. My code is below:

VB Code:
Private Sub mnutest_Click()Dim CodeText As VariantDim CurVar As VariantCodeText = Text1.TextCodeText = Split(CodeText, vbNewLine)For i = 0 To UBound(CodeText)    CurVar = Split(CodeText(i), ":")    Select Case CurVar(0)        Case "xconnect"            Call Xconnect(CurVar(1), CurVar(2))        Case "xclose"            Call XClose        Case "output"            Call Output(CurVar(1))        Case "input"            Call Iput        Case "add"            If CurVar(1) = "input" Then                Call Add(InputBox("Integer:"))            ElseIf CurVar(1) = "iput" Then                Call Add(NewVar)            Else                Call Add(CurVar(1))            End If        Case "subtract"            If CurVar(1) = "input" Then                Call Subtract(InputBox("Integer:"))            ElseIf CurVar(1) = "iput" Then                Call Subtract(NewVar)            Else                Call Subtract(CurVar(1))            End If        Case "multiply"            If CurVar(1) = "input" Then                Call Multiply(InputBox("Integer:"))            ElseIf CurVar(1) = "iput" Then                Call Multiply(NewVar)            Else                Call Multiply(CurVar(1))            End If        Case "divide"            If CurVar(1) = "iput" Then                Call Divide(InputBox("Integer:"))            Else                Call Divide(CurVar(1))            End If        Case "openfile"            Call OpenFile(CurVar(1))        Case "outputfile"            If CurVar(2) = "iput" Then CurVar(2) = NewVar            If CurVar(2) = "memory" Then CurVar(2) = Memory            If CurVar(2) = "received" Then CurVar(2) = XRecDat            If CurVar(2) = "input" Then CurVar(2) = InputBox("Input:")            If CurVar(1) = "input" Then                Call OutputFile(InputBox("File Path:"), CurVar(2))            ElseIf CurVar(1) = "iput" Then                Call OutputFile(NewVar, CurVar(2))            Else                Call OutputFile(CurVar(1), CurVar(2))            End If        Case "break"            Call Break        Case "xsend"            If CurVar(1) = "iput" Then CurVar(1) = NewVar            If CurVar(1) = "input" Then CurVar(1) = InputBox("Input:")            Call XSend(CurVar(1))        Case "assign"            If CurVar(1) = "iput" Then NewVar = CurVar(2)            If CurVar(1) = "memory" Then Memory = CurVar(2)        Case "message"            Call Message(CurVar(1))        Case Else            Text2.Text = Text2.Text & "Line " & (i) & " has error(s)!" & vbNewLine    End SelectNext iEnd Sub


Sorry about the length, i should have uploaded it or i would have but the FULL project size is 1117kbytes.

Help: &"ByRef Argument Type Mismatch&"
Ok When I try to test my code here I get a

Compile error:
ByRef argument type mismatch


Here is the code:
Code:
Private Type ANSI_STRING
       Length As Long
       MaximumLength As Long
       Buffer As Long
End Type

Private Type UNICODE_STRING
       Length As Long
       MaximumLength As Long
       Buffer As Long
End Type

Private Declare Function RtlAnsiStringToUnicodeString Lib "ntdll.dll" (DestinationString As UNICODE_STRING, SourceString As ANSI_STRING, ByVal AllocateDestinationString As Boolean) As Long

'_____________________________________________________________

Private Sub Command1_Click()

    Dim UString As UNICODE_STRING
    Dim AString As ANSI_STRING
    Dim sKeyPath As String
   
    sKeyPath = "RegistryMachineSOFTWARE"

    'Initialize ANSI_STRING:
    AString.Buffer = StrPtr(sKeyPath)
    AString.Length = LenB(sKeyPath)
    AString.MaximumLength = LenB(AString.Buffer)
    
    Dim pMem As Long: pMem = VarPtr(AString) 'get pointer of ANSI_STRING
    
    'Convert ANSI_STRING to UNICODE_STRING:
    'lStatus = RtlAnsiStringToUnicodeString(UString, ByVal VarPtr(AString), False) 'not work (ByRef Mismatch)
    lStatus = RtlAnsiStringToUnicodeString(UString, pMem, False) 'not work (ByRef Mismatch)
    
    'Return Status:
        MsgBox GetSysMsg(lStatus)

End Sub



Note: GetSysMsg is a custom function in a module to return an status string based on any API's Return Value (Works for both STATUS and NTSTATUS)


Ok so here is the problem:
When ever I try to perform this, I get an error saying:

Compile error:
ByRef argument type mismatch

and it highlights pMem. Well I am a bit confused here to why it is saying this. So I attempted to pass it ByVal and it then says:

Compile error:
User-defined type may not be passed ByVal

so how am I supposed to pass this pointer to the API ??? I mean you would just think "Oh.. pass the structure not the pointer" in which it will execute then, but when it does, it will give a return status of "Invalid Pointer".

The API wants the pointer, I just need to know how to give it to it without VB giving an error.

Thanks for your help.



Here are the links to MSDN for the API and Structures:

RtlAnsiStringToUnicodeString Function:
http://msdn2.microsoft.com/en-us/library/ms648413.aspx

UNICODE_STRING:
http://msdn2.microsoft.com/en-us/library/aa491546.aspx

ANSI_STRING:
http://msdn2.microsoft.com/en-us/library/aa492030.aspx



Edited by - AltF4 on 6/19/2007 6:40:19 PM

Type Mismatch Error On My Code
Hello folks. I would like to ask for some help regarding on the problem of my code. I have a piece of code which is:

recSet.Open "Select * from students, grades where students.id = grades.studentid Order by [Last Name]", dbConn, adOpenStatic, adLockOptimistic

it says in the error that I have a "type mismatch" on this part of the code. Can you guys help me please. Thank you and god bless!

Error No 13 Type Mismatch In Following Code
To find a word in MS-Word with files having extn .doc (new try)


Private Sub Command1_Click()
Dim Appword As Object

Set Appword = CreateObject("Word.Application")
With Appword.FileSearch
.NewSearch
.LookIn = "C:My Documents"
.SearchSubFolders = True
.TextOrProperty = "the"
** .FileType = msoFileTypeWordDocuments 'Here i get error 13
** .Execute msoSortByFileName ''Here i get error 13
End With

Appword.Visible = False

For i = 1 To Appword.FileSearch.FoundFiles.Count
List1.AddItem Appword.FileSearch.FoundFiles(i)
Next

Appword.Quit False
Set Appword = Nothing
End Sub


** Run time error 13 typemismatch

As suggested i tried
.FileType = msoFileTypeWordDocuments
.Execute msoSortByFileName
AGAIN I GET ERROR IS TYPE MISMATCH

regds

Sam F

ByRef Argument Error
I was calling an object takes two parameters, let say

dim temp as variant
obj.proc1(0, temp) 'this line return byref argument error, namely temp variable

obj is a COM object written in C++, the paramemters it take is IUnknown **, the whole head line is:

STDMETHOD(GetIUnknown)(int cfg, IUnknown ** pRowset);

My QUESTION IS:
What variable type should I have in VB in order to run this method???

Anyone can help me out? Thx

Why Am I Getting A Type Mismatch Error On This Code On The First Instance Of Set Rs =
Why am I getting a Type Mismatch error on this code on the first instance of Set rs = db.OpenRecordset(SQLString)?

Private Sub cmdFind_Click()

Dim db As Database
'This is the object that will hold the connection
'to our database

Dim rs As Recordset
'This is the object that will hold a set of
'records coming back from the database

Dim SQLString As String
'This is just to temporarily hold the SQL string

Set db = OpenDatabase("c:Program FilesMicrosoft Visual StudioNwind.mdb")
'This activates the database object, telling it
'to link to the Nwind.mdb database. Note that
'you may have to change this path depending on
'where Visual Basic has been installed on your PC.

SQLString = "SELECT Orders.CustomerID, " & _
"Count(Orders.OrderID) " & _
"AS NoOfOrders From Orders " & _
"GROUP BY Orders.CustomerID " & _
"HAVING (((Orders.CustomerID)='" & _
txtCustID.Text & "'))"
'This SQL statement was created in Access. It simply returns
'the number of orders for a particular customer using the
''Count' feature on the 'Total' line. If you'd like to use
'Count, but are a little unsure about it - search Access help -
'it's very simple!

Set rs = db.OpenRecordset(SQLString)
'This ties the recordset object with the database object.
'You're telling it to set the recordset object to whatever
'the "db.OpenRecordset" function returns. And that function
'will return a set of records according to the SQL statement
'you pass it.

If rs.BOF = True And rs.EOF = True Then
'Obviously the customer cannot be found in the
'orders table, so let's tell the user - and close
'the recordset/database connections
MsgBox ("Cannot find customer") ' - " & "txtCustID.Text & " - " & "in the Orders table!")
rs.Close
db.Close
Exit Sub
End If

txtTotalNumber.Text = rs.Fields("NoOfOrders")
'Simply throws the value in the 'NoOfOrders' field
'from the Recordset, direct into the txtTotalNumber
'text box

SQLString = "SELECT Orders.CustomerID, " & _
"Last(Orders.OrderDate) " & _
"AS LastOrderDate From Orders " & _
"GROUP BY Orders.CustomerID " & _
"HAVING (((Orders.CustomerID)='" & txtCustID.Text & "'))"
'We've already figured out the number of orders - so
'this is the SQL statement that finds out the last order
'date

Set rs = db.OpenRecordset(SQLString)
'This is the second time we've seen this statement. Here,
'it says the Recordset object to hold the records
'from our new SQLString statement

txtLastDate.Text = rs.Fields("LastOrderDate")
'Here, we're taking the information from the 'LastOrderDate'
'field and placing it in the txtLastDate text box

txtLastDate.Text = Format(txtLastDate.Text, "Long Date")
'Now we're just formatting to make it look pretty

rs.Close
'Close the Recordset

db.Close
'Close the Database

End Sub

Random Type Mismatch Error On Good Code
This is wierd...

I execute this line in my MS Access 2002 SP3 database front-end behind a form in VBA code (iTPID is an integer, lboTargetPopluations is a listbox control):

RefreshTPListBox iTPID, lboTargetPopulations

The sub I am going after starts like this:
Public Sub RefreshTPListBox(ByVal iKey As Integer, ByRef lboLBox As ListBox)

The problem is...
If I execute this on my PC at home or from someone else's workstation at work it works just fine, producing results just as expected.

However, if I execute it from my own workstation at work It returns a "Type Mismatch" error as soon as the sub is called. All three systems have MS Access 2002 SP3 installed.

Does anyone have any idea as to what the problem could be?

ByRef Argument Typ Mismatch
I know this is a Big D@mn code, I dont expect ppl to read this all, hopefully there are some usfull suggestions so I know where to search for.

Yellow markings on glbAntwoordJa(0) on the line with comment 'THIS LINE

The function, in functions.bas (standard module)

Code:
Public Sub VragenRie(hoofdvraag As Boolean, var1 As Integer, var2 As String, var3 As String)
Dim path As String
Dim lngFileCount As Integer
lngFileCount = 0
path = glbRoot & "questions/rie.dat"
Dim strLines(intChunkSize) As String
Dim strDelen() As String
Dim strOutput() As String
Dim strNummers() As String
Dim strText As String


If hoofdvraag = True Then
'kijk wat antwoord Ja of Nee is
If glbAntwoord = 1 Then ' antwoord is ja
Call VragenRie(False, glbAntwoordJa(0), glbAntwoordJa(1), glbAntwoordJa(2)) '[b]THIS LINE[/b]
ElseIf glbAntwoord = 2 Then ' antwoord is ja
Call VragenRie(False, glbAntwoordNee(0), glbAntwoordNee(1), glbAntwoordNee(2))
End If
End If

Open path For Input As #1 ' Open het bestand

Do While Not EOF(1)
If lngFileCount = UBound(strLines) Then ' See if we have enough space
ReDim Preserve strLines(lngFileCount + intChunkSize) ' Increase array size
End If
Line Input #1, strLines(lngFileCount) ' Read the line from the file

strDelen = Split(strLines(lngFileCount), ";")
strNummers = Split(strDelen(0), ".")
lngFileCount = lngFileCount + 1 ' and increment the line counter

strOutput(0) = strNummers(0) 'Hoofstuknummer
strOutput(1) = strNummers(1) 'SubHoofdstuknummer
strOutput(2) = strNummers(2) 'Vraagnummer
strOutput(3) = strDelen(2) 'Text

If strOutput(0) = var1 And strOutput(1) = var2 And strOutput(2) = var3 Then
'match gevonden.

If var2 = x And var3 = x Then '
' Hoofdstuk
glbNummer1 = strOutput(0)
glbHoofdstuk = strOutput(3)
Call VragenRie(False, var1, 1, "x") 'Roep de subparagraaf op
Exit Function ' Stop de functie.
ElseIf var3 = x Then
glbNummer2 = strOutput(1)
glbSubHoofdstuk = strOutput(3)
Call VragenRie(False, var1, var2, "x") 'Roep de subparagraaf op
Exit Function ' Stop de functie.
ElseIf var3 = 0 Then
glbNummer3 = strOutput(2)
glbVraag = strOutput(3)
glbAntwoordJa(0) = var1
glbAntwoordJa(1) = var2
glbAntwoordJa(2) = 1
glbAntwoordNee(0) = var1
glbAntwoordNee(1) = var2 + 1
glbAntwoordNee(2) = var3
Exit Function ' Stop de functie.
Else
glbNummer3 = strOutput(2)
glbVraag = strOutput(3)
Exit Function ' Stop de functie.
End If
'einde match gevonden
End If
Loop
Close #1 'sluit bestand die nummer 1 heeft toegewezen gekregen


End Sub

Scriptcode on the form where I came from:


Code:
Private Sub Command2_Click()
If Check1.Value = vbChecked Then
glbCheck1 = True
Else
glbCheck1 = False
End If

If Check2.Value = vbChecked Then
glbCheck2 = True
Else
glbCheck2 = False
End If

If Check3.Value = vbChecked Then
glbCheck3 = True
Else
glbCheck3 = False
End If

Call SwitchForm(Me, Form3)
End Sub

The error occured on opening Form 3

Form3 code:

Code:
Private Sub Command1_Click()
Call SwitchForm(Me, Form4)
End Sub

Private Sub Command2_Click()
Call SwitchForm(Me, Form3a)
End Sub

Private Sub Form_Load()
Call FormSize(Me) ' Form Size
Call VragenRie(False, 1, "x", "x") 'roep de eerste vraag op
Text1.Text = glbHoofdstuk
Text2.Text = glbSubHoofdstuk
Text3.Text = glbVraag
Text4.Text = glbNummer1 & " . " & glbNummer2 & " . " & glbNummer3
End Sub


All my globals are inside a module, globals.bas


Code:
' Deze module gebruiken om alle constanten te declearen. Het vullen moet gebeuren
' eventueel via de onload van form2, na het inloggen.
' Hiermee even wat tests doen. Belang van dit is dat alle gegevens voorhanden zijn.
' Zo minmogelijk zaken binne de forms regelen. Veel voorkomende zaken in functies
' binnen een module.

Global Const intChunkSize As Integer = 20 ' Deze maakt de array grootte
Global glbRoot As String ' Maakt de variabele, die de plaats van bin geeft
Global glbBedrijf As String ' Bedrijfsnaam, op het moment dat hij geselecteerd is
Global glbBedrijfnaam As String ' Bedrijfsnaam, op het moment dat hij geselecteerd is
Global glbMachine As String ' Machine naam, op het moment dat hij geselecteerd is
Global glbMachinenaam As String ' Machine naam, op het moment dat hij geselecteerd is

Global strBedrijfMappen() As String ' Mappen
Global strBedrijfMappenAantal As Integer ' Aantal mappen
Global glbMachineMappen() As String ' Mappen
Global glbMachineMappenAantal As Integer ' Aantal mappen

Global glbCheck1 As Boolean 'Checkbox nummer 1
Global glbCheck1File As String ' Volledig pad naar de vragenlijst

Global glbCheck2 As Boolean 'Checkbox nummer 2
Global glbCheck2File As String ' Volledig pad naar de vragenlijst

Global glbCheck3 As Boolean 'Checkbox nummer 3
Global glbCheck3File As String ' Volledig pad naar de vragenlijst

' Hier voor de Bedrijfsvragen weergave
Global glbHoofdstuk As String 'Hoofdstuk naam
Global glbSubHoofdstuk As String 'Onderliggende paragraag naam
Global glbNummer1 As Integer 'Eerste nummer vraag, dus hoofdstuknummer
Global glbNummer2 As Integer 'Tweede nummer vraag, dus subhoofdstuknummer
Global glbNummer4 As Integer 'Derde nummer vraag, dus vraagnummer
Global glbVraag As String 'De vraag zelf
Global glbAntwoordJa(5) As String 'Waar naartoe als Ja het antwoord is
Global glbAntwoordNee(5) As String 'Waar naartoe als Ja het antwoord is

The script is meaned to read out and post questions from this file: rie.dat

Code:
1.x.x;;Het Gebouw
1.1.x;;Elk gebouw
1.1.0;;Het werk vindt plaats op een vaste locatie in een gebouw.
1.1.1;;Het gebouw wordt goed onderhouden.
1.1.2;;Het interieur van het gebouw wordt goed schoongemaakt.
1.1.3;;De elektrische-, gas- en watervoorzieningen zijn in orde en worden goed onderhouden.
1.1.4;;Er zijn sanitaire voorzieningen aanwezig.

This is just a part of the file. It uses a cascade system.

1.x.x. is the main group
1.1.x is a sub group, which is not in every maingroup
1.1.0 Is the main question, wenn answering NO, none of the 1.1.A questions will be answered, and it should go to 1.2.x
Wenn the answer is yes, it will go to 1.1.1
After evry answer it will go to the next number, being 1.1.2, 1.1.3 etc.
Wenn the number does not excist, it will look look for 1.2.x (so the middle value + 1)

if their is no 1.2.x, like allready shown, it will go to 1.2.0
If thisone also does not excist, again to 1.2.1

It will do all of this, untill their is no valide match, and the searchloop has ended.


I know this is a Big **** code, I dont expect ppl to read this all, hopefully there are some usfull suggestions so I know where to search for.

About Byref Argument Mismatch
I am using a function I defined in the program. The problem is that , every time when that function is run, " Byref argument type mismatch " error will occur.

Here is my code. Would somebody help me with this? I really can't figure it out.


private sub update_change()
dim ssql as string
Dim cnn As New ADODB.Connection
Dim rs1 As ADODB.Recordset
dim ssql as string

........
cnn.coonectionstring = ..........
ssql = " select * from table1"


' the error always appears when the following code is implemented, and "ssql" is highlighted.

set rs1 = getrecordset ( cnn, ssql)

.....
end sub



' here is my function

Private Function GetRecordSet(cnnConnection As ADODB.Connection, ssql As String) As ADODB.Recordset
Dim rstCustomers As Recordset
Set rstCustomers = New Recordset

rstCustomers.CursorType = adOpenKeyset
rstCustomers.LockType = adLockOptimistic
rstCustomers.CursorLocation = adUseClient
rstCustomers.Source = ssql
Set rstCustomers.ActiveConnection = cnnConnection
rstCustomers.Open

Set GetRecordSet = rstCustomers
End Function

Excel Vba - ByRef Argument Mismatch
Hi
I have the following code:

Code:Private Sub CommandButton5_Click()
  frmMainSystemMenu.Hide
  FillListBoxWithStudentNames ListBox1
  frmStudName.Show
End Sub

Code:Sub FillListBoxWithStudentNames(LB As ListBox)
'Declarations
Dim C As Range, lngLastNameRow As Long, lngStartNameRow As Long, lngNameCol As Long

    lngNameCol = Range(StartCSVvalues).Column ' start csvvalues is set to c6
    lngStartNameRow = Range(StartCSVvalues).Row
    lngLastNameRow = Range(StartCSVvalues).End(xlDown).Row

    With CSVsheet
        For lngStartNameRow = lngStartNameRow To lngLastNameRow
        LB.AddItem .Cells(lngStartNameRow, lngNameCol).Value
        'LB.AddItem .Cells(lngStartNameRow, lngLastNameRow).Value
        Next
    End With
    Set LB = Nothing
End Sub

When I click on a command button, the line above is highlighted in debug mode and I get this
Compile error:
ByRef Argument type mismatch

Does anyone have any ideas how to fix this?

many thanks in advance
natalie



 

Find Error 13 Type Mismatch / Tool To Check Source Code
Hi,

I have a bug somewhere im my large VB6 project, which sometimes causes a Error 13 Type Mismatch. Problem is: The error never occurs on my PC, but only on customer PCs and all I get is an anonymous "I had an Error 13". Hence I'm clueless how to track that error.

Is there any possiblility to check the source code for improper assignments like integer=string or alike?

How do you check your source code for potential problems (exept for testing, testing, testing ;-)?

thanx!

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