Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    123

    Unanswered: Data type mismatch?

    I'm getting a strange error on a seemingly simple bit of code. The following is getting "Run Time Error 13: Type Mismatch".

    The variable below, "tag44", is a declared Variant passed from another subroutine. Although not specified, it is always a string and one of four values, "BTO","STO","BTC","STC". When the error occurs, it is at the third of three subroutines, and the variable has been successfully passed from the previous two already. None of the others specify the variable as a string.

    Sub PostTrade(tag12, tag39, tag44, etc.)

    'tag44 currently = "BTO"

    If tag44 = "BTC" Or "STC" Then
    'Call ClosePosition()
    Else
    'Call OpenPosition()
    End If

    End Sub

  2. #2
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Data type mismatch?

    Originally posted by jrn0074
    I'm getting a strange error on a seemingly simple bit of code. The following is getting "Run Time Error 13: Type Mismatch".

    The variable below, "tag44", is a declared Variant passed from another subroutine. Although not specified, it is always a string and one of four values, "BTO","STO","BTC","STC". When the error occurs, it is at the third of three subroutines, and the variable has been successfully passed from the previous two already. None of the others specify the variable as a string.

    Sub PostTrade(tag12, tag39, tag44, etc.)

    'tag44 currently = "BTO"

    If tag44 = "BTC" Or "STC" Then
    'Call ClosePosition()
    Else
    'Call OpenPosition()
    End If

    End Sub
    Try If tag44 = "BTC" Or tag44 = "STC" Then
    Gregg


    DAO, ADO, SQL, Automation and anything else I can pick up.

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Data type mismatch?

    Originally posted by jrn0074
    I'm getting a strange error on a seemingly simple bit of code. The following is getting "Run Time Error 13: Type Mismatch".

    The variable below, "tag44", is a declared Variant passed from another subroutine. Although not specified, it is always a string and one of four values, "BTO","STO","BTC","STC". When the error occurs, it is at the third of three subroutines, and the variable has been successfully passed from the previous two already. None of the others specify the variable as a string.

    Sub PostTrade(tag12, tag39, tag44, etc.)

    'tag44 currently = "BTO"

    If tag44 = "BTC" Or "STC" Then
    'Call ClosePosition()
    Else
    'Call OpenPosition()
    End If

    End Sub
    This line is invalid: "If tag44 = "BTC" Or "STC" Then"

    Try something like: If tag44 = "BTC" Or tag44 = "STC" Then


    Ah hem ... I see I was beaten to the punch ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •