Skip to Content

code error problem

Dear All Experts 😊,

When running this following VB6 codes, I've got Run time error 13 type mismatch:

If pVal.ItemUID = "CMDBTN1" Then
    If pVal.EventType = et_ITEM_PRESSED And pVal.BeforeAction = True Then
       'Set oForm = SboApplication.Forms(pVal.FormUID)
       Set oForm = SboApplication.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
       Dim tgl5 As String
       Set oEdit = oForm.Items("1000004").Specific
       'tgl5 = oEdit.String

 StrSQL = "exec uspADCashReceipt '" & Tgl5 & "'"
       ViewReport "ADCashRCPT.rpt"

The SP code (StrSQL):

 [dbo].[uspADCashReceipt] @date varchar(10)

SELECT T0.DocDate, T1.DueDate, T2.BankName, T0.BankCountr,
       T1.AcctNum, T1.U_NSAcc, T1.CheckNum, T1.CheckSum,T0.CardName, 
       T3.City
FROM ORCT T0 INNER JOIN RCT1 T1 ON T0.DocNum = T1.DocNum
     INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode,
     ODSC T2 
      
WHERE T2.BankCode = T1.BankCode and T0.Canceled = 'N' and 
      T0.DocDate = (substring (@Date,6,3)+'/'+substring (@Date,1,3)+'/'+substring (@Date,8,3))
      and T0.Canceled ='N'

How to resolve ? Pls give advice.Thanks

Rgds,

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 16, 2008 at 09:36 AM

    I think that the problem is in sp in line

    T0.DocDate = (substring (@Date,6,3)'/'substring (@Date,1,3)'/'substring (@Date,8,3))

    parameters of substring are FROM, BEGIN POSITION, LENGTH and isnt allowed for using of date formats. Try to cast the @date to varchar or nchar.

    DocDate is stored in db as datetime format, so you cannot parse it and T0.DocDate = @Date should be enough. Maybe the problem should be in input paramateres to sp - if zou have in edittext date in format 1/1/2008 - this is not correct date format for sp.

    If it doesnt help, try the date hardcode in sp and check, if the error persist.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 05, 2009 at 10:27 AM

    Hi Petr,

    Sorry for made a mistaken in writing the code in this message. it is not date15 but it should be date1, so the correct codes (VB6 and SP) as follows:

    
    This is the addon source code that gives run time error (13) :
    
    
    
    If pVal.ItemUID = "CMDBTN1" Then
        If pVal.EventType = et_ITEM_PRESSED And pVal.BeforeAction = True Then
           'Set oForm = SboApplication.Forms(pVal.FormUID)
           Set oForm = SboApplication.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
           Dim date1 As String
           Set oEdit = oForm.Items("1000004").Specific
           date1= oEdit.String
     
     StrSQL = "exec uspADCashReceipt '" & Date1 & "'"
           ViewReport "ADCashRCPT.rpt"
     
    
    
    
    The SP is as follows:
    
    
    
    [dbo].[uspADCashReceipt] @date1 varchar(10)
     
    SELECT T0.DocDate, T1.DueDate, T2.BankName, T0.BankCountr,
           T1.AcctNum, T1.U_NSAcc, T1.CheckNum, T1.CheckSum,T0.CardName, 
           T3.City
    FROM ORCT T0 INNER JOIN RCT1 T1 ON T0.DocNum = T1.DocNum
         INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode,
         ODSC T2 
          
    WHERE T2.BankCode = T1.BankCode and T0.Canceled = 'N' and 
          T0.DocDate = (substring (@Date1,6,3)+'/'+substring (@Date1,1,3)+'/'+substring (@Date1,8,3))
          and T0.Canceled ='N'
     
    
    
    

    Running the above code in SAP 2007A and SQL 2005 can't be success but in the SAP B1 2004A can. do you think that there will possible to still use the VB codes ?

    as about the date1, I think it is used to define the date variable in the report generated.

    Rgds,

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 19, 2009 at 04:34 AM

    Hi All,

    I managed to solve this issue. Thx for your previous helps.

    Rgds,

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.