none
AC.2013.Crash by IsMissing... RRS feed

  • Question

  • Hi  ,iconfused.gif

    Option Compare Database
    Option Explicit
    
    Sub testIsMissing()
    Dim lvTMP As Variant, llRet As Boolean
    Dim lv1 As Variant, la1() As Variant
    llRet = IS_EMPTY2(lv1)
    llRet = IS_EMPTY2(la1) '<-------CRASH
    llRet = IS_EMPTY(lv1)
    llRet = IS_EMPTY(la1) '<-------CRASH
    End Sub
    Public Function IS_EMPTY(varString As Variant) As Boolean
    Dim lvTMP As Variant, llRet As Boolean
    lvTMP = varString
    If IsNull(lvTMP) Or IsMissing(lvTMP) Then
        llRet = True
    End If
    IS_EMPTY = llRet
    End Function
    Public Function IS_EMPTY2(Optional varString As Variant) As Boolean
    Dim lvTMP As Variant, llRet As Boolean
    lvTMP = varString '-------CRASH--..IsMissing
    If IsNull(lvTMP) Or IsMissing(lvTMP) Then
        llRet = True
    End If
    IS_EMPTY2 = llRet
    End Function


    dBase,FoxPro,MS Access 2003,(2010=Not rec.),Office 2010+ACC.2013 ,Symbian C++, AC.2013.SystemResource.GetCurrentFreeSize=?


    • Edited by PACALA_BA Tuesday, February 2, 2016 5:06 PM
    Tuesday, February 2, 2016 4:29 PM

Answers

  • Hi , then OK ... 

    IsMissing Function   , put there Text....... IsMissing returns CRASH for Variant/Empty Array.

    Option Compare Database
    Option Explicit
    
    Sub testErase2()
    Dim lv1 As Variant
    lv1 = get_array
    lv1 = set_array(lv1)
    'CLENUP
    AA_ERASE lv1
    End Sub
    Function get_array() As Variant
    Dim la1() As Variant
    'DO SOMETHING HERE
    get_array = la1()
    End Function
    Function set_array(varArray As Variant) As Variant
    'DO SOMETHING HERE
    set_array = varArray
    End Function
    Public Function AA_ERASE(V1 As Variant)
    On Error GoTo LBL_xPAC_ERR
    If Not IsMissing(V1) Then If IsArray(V1) Then Erase V1  'CRASH...IsMissing(V1)
    LBL_xPAC_END:
    Exit Function
    LBL_xPAC_ERR:
    Resume Next
    Resume
    End Function

    IsMissing returns True if no value has been passed for the specified argument; otherwise, it returns False. If IsMissing returns True for an argument, use of the missing argument in other code may cause a user-defined error. If IsMissing is used on a ParamArray argument, it always returns False. To detect an empty ParamArray, test to see if the array's upper bound is less than its lower bound.

    IsMissing returns CRASH for Variant/Empty Array...........MISSING NOTE !!!


    dBase,FoxPro,MS Access 2003,(2010=Not rec.),Office 2010+ACC.2013 ,Symbian C++, AC.2013.SystemResource.GetCurrentFreeSize=?

    • Marked as answer by PACALA_BA Thursday, February 4, 2016 3:59 PM
    Thursday, February 4, 2016 2:03 PM

All replies

  • Did you mean

    testIsMissing


    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Tuesday, February 2, 2016 5:34 PM
  • You are trying to assign an empty array to a non-array variable.

    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    Tuesday, February 2, 2016 5:38 PM
  • You are trying to assign an empty array to a non-array variable......ERROR=0...!!

    Hi, i am trying to assign an empty array to a VARIANT variable.

    It is not about  "assigning" a value , it is about ......Ismissing

    But, Crash is here:..Ismissing (empty array() as Variant )....iconfused.gif

    But,:..Ismissing (empty array() as String).....OK..................iconfused.gif

    Option Compare Database
    Option Explicit
    
    Sub testErase()
    Dim ln1 As Long, llRet As Boolean
    Dim lv1 As Variant, la1() As Variant
    Dim lv2 As Variant, lv3 As Variant, la2() As String, la3() As Variant
    lv2 = Array(1, 2, 3)
    ReDim Preserve la1(0 To 0)
    lv3 = la1
    AA_ERASE lv1, la1, lv2, lv3, la2, la3
    End Sub
    
    Public Function AA_ERASE(V1 As Variant, Optional V2 As Variant, _
        Optional V3 As Variant, Optional V4 As Variant, Optional V5 As Variant, Optional V6 As Variant)
    On Error GoTo LBL_xPAC_ERR ' On Error GoTo LBL_xPAC_ERR 'On Error Resume Next
    Dim lv1 As Variant, lv2 As Variant, la1() As Variant, la2() As String
    Dim ll1 As Boolean
    If Not IsMissing(V1) Then If IsArray(V1) Then Erase V1  'CRASH...IsMissing(V1)
    If Not IsMissing(V2) Then If IsArray(V2) Then Erase V2
    If Not IsMissing(V3) Then If IsArray(V3) Then Erase V3
    If Not IsMissing(V4) Then If IsArray(V4) Then Erase V4
    If Not IsMissing(V5) Then If IsArray(V5) Then Erase V5  'ERR/CRASH: ParamArray Arglist(),  Erase Arglist(I)
    If Not IsMissing(V6) Then If IsArray(V6) Then Erase V6
    '----
    If Not IsMissing(lv1) Then If IsArray(lv1) Then Erase lv1
    If Not IsMissing(la1) Then If IsArray(la1) Then Erase la1
    ll1 = IsMissing(la2) ' la2() As String
    lv2 = la2
    If Not IsMissing(lv2) Then If IsArray(lv2) Then Erase lv2
    ll1 = IsMissing(la1) 'la1() As Variant
    lv2 = V5 '() As String
    If Not IsMissing(lv2) Then If IsArray(lv2) Then Erase lv2
    lv2 = V6 '() As Variant,  NEXT LINE CRASH by..IsMissing(lv2)
    If Not IsMissing(lv2) Then If IsArray(lv2) Then Erase lv2
    LBL_xPAC_END:
    Exit Function
    LBL_xPAC_ERR:
    Resume Next
    Resume
    End Function ' Debug.Print "Err:" & Err & ", " & Err.Description
    
    



    dBase,FoxPro,MS Access 2003,(2010=Not rec.),Office 2010+ACC.2013 ,Symbian C++, AC.2013.SystemResource.GetCurrentFreeSize=?

    Wednesday, February 3, 2016 12:09 PM
  • Hi,

    The IsMissing function is used to indicate whether an optional Variant argument has been passed to a procedure. This function need a parameter instead of define a new variable and set its value equal parameter of the function.

    I suggest that you using this function for the argument of function first then write your own business logic to set the value of new variables.

    Please refer to link below about more detail:

    IsMissing Function

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, February 4, 2016 5:58 AM
    Moderator
  • Hi , then OK ... 

    IsMissing Function   , put there Text....... IsMissing returns CRASH for Variant/Empty Array.

    Option Compare Database
    Option Explicit
    
    Sub testErase2()
    Dim lv1 As Variant
    lv1 = get_array
    lv1 = set_array(lv1)
    'CLENUP
    AA_ERASE lv1
    End Sub
    Function get_array() As Variant
    Dim la1() As Variant
    'DO SOMETHING HERE
    get_array = la1()
    End Function
    Function set_array(varArray As Variant) As Variant
    'DO SOMETHING HERE
    set_array = varArray
    End Function
    Public Function AA_ERASE(V1 As Variant)
    On Error GoTo LBL_xPAC_ERR
    If Not IsMissing(V1) Then If IsArray(V1) Then Erase V1  'CRASH...IsMissing(V1)
    LBL_xPAC_END:
    Exit Function
    LBL_xPAC_ERR:
    Resume Next
    Resume
    End Function

    IsMissing returns True if no value has been passed for the specified argument; otherwise, it returns False. If IsMissing returns True for an argument, use of the missing argument in other code may cause a user-defined error. If IsMissing is used on a ParamArray argument, it always returns False. To detect an empty ParamArray, test to see if the array's upper bound is less than its lower bound.

    IsMissing returns CRASH for Variant/Empty Array...........MISSING NOTE !!!


    dBase,FoxPro,MS Access 2003,(2010=Not rec.),Office 2010+ACC.2013 ,Symbian C++, AC.2013.SystemResource.GetCurrentFreeSize=?

    • Marked as answer by PACALA_BA Thursday, February 4, 2016 3:59 PM
    Thursday, February 4, 2016 2:03 PM