Arguments are of the wrong type, are out of acceptable range, or are in conflict with RRS feed

  • Question

  • wrong data type

    Public Function SendFax(FaxNumber As String, RecipientName As String, Subject As String, faxDoc() As Byte)

      Dim strConnection As String
        Dim oDB As ADODB.Connection
       Dim oCmd As ADODB.Command

       strConnection = "Provider=SQLOLEDB.1;Data Source=" & DataSource & ";Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" & DatabaseNameFax & ";Application Name=""Receipt Macro"""

        Set oDB = New ADODB.Connection
       oDB.Open strConnection
       Set oCmd = New ADODB.Command
       With oCmd
          Set .ActiveConnection = oDB
            .CommandType = adCmdStoredProc
           .CommandText = "Sp_Faxinput"
            .Parameters.Append .CreateParameter("@FaxNumber", adVarWChar, adParamInput, 100, FaxNumber)
           .Parameters.Append .CreateParameter("@RecipientName", adVarWChar, adParamInput, 1000, "RecipientName ") 'Block and Slide Ids are private - not intended for the customer
            .Parameters.Append .CreateParameter("@Subject", adVarWChar, adParamInput, 1000, "Subject")
           .Parameters.Append .CreateParameter("@FaxDoc", advarByte, adParamInput, 10000, faxDoc)

            .NamedParameters = True
        End With
      Set oCmd = Nothing
    End Function

    what is the right data type i should give for  .Parameters.Append .CreateParameter("@FaxDoc", advarByte, adParamInput, 10000, faxDoc)


    Thursday, March 15, 2012 5:31 PM

All replies

  • Hi Rushdy,

    the problem should with the FacDoc() code that you have written with..,

    Please check the datatype of the data that is input into the f() and the output.

    I think, CreateParameter's last parameter would not have been byte as the FacDoc returns byte.

    With regards

    Love the Love that Loves the Love and Hate the Love that Loves the Hate.

    Tuesday, March 20, 2012 1:59 PM
  • FaxDoc is a byte array the code is as below
    Appreciate your help

    Dim faxDoc() As Byte
     Dim filenum As Integer
    Dim sNewFilename As String

    filenum = FreeFile
     Open sNewFilename For Binary As filenum
     faxDoc = Input(LOF(filenum), #filenum)

    fax = SendFax("01112212121", "test", "subject", faxDoc)

    Tuesday, March 20, 2012 2:31 PM