'NOTES: '======================================= 'EXAMPLE OF THE FORMAT USED TO STORE VARIABLES WITH THE NEW EncodeVar(): 'VAR1 = 1 'EncodeVar(VAR1, "VAR1") ---> Returns a string: "VAR1-eq-021-+-" ' where: VAR1 is the name it is stored under ' -eq- represents "equals" ' 0 is a space holder to make 1 digit VarType identifier use 2 spaces ' 2 is the VarType indicating VAR1 is an integer ' 1 is the value of VAR1, now stored as type string ' -+- is a spacer between stored variables in the CustomMem string ' 'GENERAL FORM OF HOW VARIABLES ARE SAVED TO CustomMem: 'CustomMem = EncodeVar(VAR1, "VAR1") & EncodeVar(TestVar2, "TestVar2") & EncodeVar(TestVar3, '"TestVar3") & 'EncodeVar(TestVar4, "TestVar4") ' '======================================= ' 'Substitute the following two functions for the one's that are 'in the original posted Zabaware CustomMem code. No modifications 'are needed to EncodeVar() or DecodeVar() usage within your code. 'Just substitute the functions defined below. '======================================= 'This function is used in conjunction with CustomMem to encode custom user variables 'into the single string called CustomMem. CustomMem is saved prior to exiting 'GetResponse so that the user variables are preserved until needed later. Function EncodeVar(EncodeWhat, AsWhat) 'Determine if the VarType identifier of the user variable has 1 or 2 digits. 'Then encode the VarType info into the first two spaces before the variable. Use "0" 'as a spacer to make 1 digit VarType identifiers use 2 spaces for easier decoding 'later. Arrays are not supported by CustomMem and not supported here. Select Case Len(VarType(EncodeWhat)) Case "1" EncodeVar = AsWhat & "-eq-" & "0" & VarType(EncodeWhat) & EncodeWhat & "-+-" Case "2" EncodeVar = AsWhat & "-eq-" & VarType(EncodeWhat) & EncodeWhat & "-+-" Case "4" EncodeVar = AsWhat & "-eq-" & "08" & "EncodeVar: Arrays Not Supported Error" & "-+-" Case Else EncodeVar = AsWhat & "-eq-" & "08" & "EncodeVar: Unknown Error" & "-+-" End Select End Function 'This function decodes custom user variable out of the single string called CustomMem. 'This function also retrieves the 2 digit VarType identifier attached to the front 'of the user variable and uses that information to convert the variable back into the 'original data type that it was prior to encoding. Otherwise all types would get returned 'incorrectly as type string. Function DecodeVar(FromWhat, DecodeWhat) 'Find the beginning of the VarType identifier which is followed by the user variable 'in the CustomMem string. IndStart = InStr(1, FromWhat, DecodeWhat & "-eq-", vbTextCompare) + Len(DecodeWhat) + 4 'Find the end of the user variable in the CustomMem string. VarEnd = InStr(IndStart, FromWhat, "-+-", vbTextCompare) 'Check for user variables with no value and return them empty. If IndStart <= Len(DecodeWhat) + 4 Then DecodeVar = "" Else 'Find the start of the user variable by moving two spaces past the VarType identifier in 'in the CustomMem string. VarStart = IndStart + 2 'Extract the user variable. DecodeVar = Mid(FromWhat, VarStart, VarEnd - VarStart) 'Use the extracted VarType identifier to decide how to convert the value of 'DecodeVar into the original correct data type. Please note that not all data 'types are decoded in this program code. The most common used variable types 'are supported; integer, long, single, double, string and boolean all work. 'Other data types may work, but have not been fully tested. 'Extract the 2 digit VarType Identifier. Select Case Mid(FromWhat, IndStart, 2) Case "00" DecodeVar = "" Case "01" DecodeVar = "" 'This should really be returning a Null instead. Case "02" DecodeVar = CInt(DecodeVar) 'Type Integer. Case "03" DecodeVar = CLng(DecodeVar) 'Type Long. Case "04" DecodeVar = CSng(DecodeVar) 'Type Single. Case "05" DecodeVar = CDbl(DecodeVar) 'Type Double. Case "06" DecodeVar = CCur(DecodeVar) 'Type Currency. Case "07" DecodeVar = CDate(DecodeVar) 'Type Date. Case "08" 'Type String. Do nothing, DecodeVar is already a string. Case "09" 'TBD, is Automation object, what needs to be done here? Case "10" 'TBD, is Error. Case "11" If DecodeVar = "True" Then 'Type Boolean. DecodeVar = True Else DecodeVar = False End If Case "12" 'TBD, Variant (used only with arrays of Variants), not supported here. Case "13" 'TBD, is Data-access object, what needs to be done here? Case "17" DecodeVar = CByte(DecodeVar) 'Type Byte Case Else DecodeVar = "" 'Don't know what situation would cause Case Else. End Select End If End Function