Hi, All!

I'm creating an Appt Schedule for a local hair salon.

Because of prior commitments, I had to put it on the shelf for 2 
weeks.  The owner of the hair salon said there was no problem.

I went back to it yesterday and even though it was working 
perfectly, up to that point, I'm now getting an "Invalid Property 
Value".

How do you fix something that was working before?  There are no 
logical explanation for it!!

The offending line is marked with >>>>>  <<<<<<.  You can find it in 
the Case adDate after the  Case adCurrency

Private Sub LoadMEControl(X As Integer, cFldName As String, cMask As 
String)
'-------------------------------------
' Load a Masked Edit control
'-------------------------------------
Dim sText As String
Dim aMask() As String
' This is an alternative to using the GetLocaleInfo() API
' to retrieve the decimal point character used on this machine:
Dim cLocalDec As String * 1: cLocalDec = Replace(Format
(0, ".0"), "0", "")
   If X > 0 Then
       Load txtMEB(X)
   End If

   With txtMEB(X)
  ' Set some defaults; we may change these below
   .Visible = True
   .Mask = ""
   .Format = ""
   .ClipMode = mskExcludeLiterals
   .PromptInclude = True
   .CausesValidation = True
   ' -------------------------------------------------------
   ' Set the Left and Top positions. Height will not change.
   ' Width will be determined by the RecalcMaxWidth() sub
   ' in this form
   ' -------------------------------------------------------
   .Move (Label1(0).Left + Label1(0).Width + 200), Label1(X).Top - 60

    If oRst.EOF Then   ' We're adding a new record
     
    ' When assigning Default string values under Access, Access adds
    ' surrounding quotes; we get rid of them here:
      sText = Replace(oCat.Tables(Me.BaseTable).Columns
(cFldName).Properties("Default").Value & "", """", "")
    
    Else
      If Not IsNull(oRst.Fields(cFldName).Value) Then
       sText = Trim(oRst.Fields(cFldName).Value & "")
      Else
       sText = Replace(oCat.Tables(Me.BaseTable).Columns
(cFldName).Properties("Default").Value & "", """", "")
      End If
      
    End If
    
    sText = Replace(sText, vbCrLf, " ")   ' There are peculiarities 
in the Customer table...

    If cMask <> "" Then
     ' The "description" of the field may contain nothing, a Mask 
and/or
     ' a Format string. If both Mask and Format strings are to be 
assigned
     ' then they are separated by a pipe "|" character; for example:
     ' ##.##|99.99
     ' To skip the Mask and assign only a Format then store the 
following
     ' in the description of the field:
     ' |99.99
       aMask = Split(cMask, "|")
      .ClipMode = mskIncludeLiterals
      .Mask = aMask(0)
      .PromptInclude = False
      If UBound(aMask) = 1 Then
      .Format = aMask(1)
      End If
      .Text = sText
      Label1(X).Tag = .Text
    
    Else   ' No mask was passed; let's try to figure out an 
appropriate one
       Dim nFieldDataType As DataTypeEnum
       nFieldDataType = oRst.Fields(cFldName).Type
       Select Case nFieldDataType         
        ''''''''''''''''''''''''''''''''''''''''''''
        ' Begin numeric values
        ''''''''''''''''''''''''''''''''''''''''''''
        ' These types do not allow decimal points:
         Case adUnsignedTinyInt    ' Byte
          .Text = sText
          .MaxLength = 3           ' 0-255
          .Format = "0"
                    
         Case adSmallInt           ' Integer
          .Text = sText
          .MaxLength = 6           ' -32,768 to 32,767
          .Format = "0"
         
         Case adInteger            ' Long Integer
          .Text = sText
          .MaxLength = 10          '-2,147,483,648 to 2,147,483,647
          .Format = "0"
          ' Don't mess with AutoNumber fields!
           If oCat.Tables(Me.BaseTable).Columns(cFldName).Properties
("Autoincrement") = True Then
'            .Enabled = False
            .Visible = False
           End If
         
         Case adNumeric            ' Decimal
          .Text = sText
           sText = Replace(.Text, cLocalDec, ".")
          .MaxLength = 10          ' +/-
79228162514264337593543950335 (No decimal)
                                   ' +/-
7.9228162514264337593543950335 with 28 places to the
                                   '                                 
   right of the decimal
                                   ' +/-
0.0000000000000000000000000001 Smallest non-zero number
          .Format = "0"
        
        ' These types allow decimal points:
        '     Single    Double
         Case adSingle
          .Text = sText
           sText = Replace(.Text, cLocalDec, ".")
          .MaxLength = 10          ' -3.402823E38  to -1.401298E-45 
for negative values;
                                   '  1.401298E-45 to  3.402823E38  
for positive values
         
         Case adDouble
          .Text = sText
           sText = Replace(.Text, cLocalDec, ".")
          .MaxLength = 10          ' -1.79769313486232E308  to -
4.94065645841247E-324 for negative values;
                                   '  4.94065645841247E-324 to  
1.79769313486232E308  for positive values
        
         Case adCurrency
          .Format = "0.00"
          .Text = Format(sText, .Format)
           sText = Replace(.Text, cLocalDec, ".")
          .MaxLength = 10          ' -922,337,203,685,477.5808 to 
922,337,203,685,477.5807
        
        ''''''''''''''''''''''''''''''''''''''''''''
        ' End of numeric values
        ''''''''''''''''''''''''''''''''''''''''''''
         Case adVarWChar   ' Text fields
          .Text = sText
          .MaxLength = oRst.Fields(cFldName).DefinedSize
'          .Move .Left, .Top, .MaxLength * m_nAvgWidth
        
         Case adDate
           Dim cLocalFmt As String: cLocalFmt = LCase(LocaleInfo
(LOCALE_SSHORTDATE))
           Dim cLocalSep As String: cLocalSep = LocaleInfo
(LOCALE_SDATE)
          .ClipMode = mskIncludeLiterals
          .PromptInclude = True
          .Format = LCase(cLocalFmt)   ' will be, for 
example "mm/dd/yy"
          
           cLocalFmt = Replace(cLocalFmt, "y", "#")
           cLocalFmt = Replace(cLocalFmt, "m", "#")
           cLocalFmt = Replace(cLocalFmt, "d", "#")
          .Mask = cLocalFmt            ' will be, for 
example "##/##/##"

>>>>>>>>    .Text = Format(IIf(IsDate(sText), sText, Now), .Format)
<<<<<<<<< sText = .Text .MaxLength = Len(.Text)
'          .Move .Left, .Top, Me.TextWidth(String(Len(.Format), "9"))
            
        ' GUID
         Case adGUID
          ' Don't mess with AutoNumber fields!
           If oCat.Tables(Me.BaseTable).Columns(cFldName).Properties
("Jet OLEDB:AutoGenerate") = True Then
            .Enabled = False
           End If
         
        ' Hyperlink or Memo field
         Case adLongVarWChar
           If oCat.Tables(Me.BaseTable).Columns(cFldName).Properties
("Jet OLEDB:Hyperlink") = True Then
           Else    ' must be a memo field
           End If
         
       End Select     
    
'        If IsANumeric(nFieldDataType) Then
'           .Move .Left, .Top, Me.TextWidth(String(.MaxLength, "9"))
'        Else
       
'        End If
    
    End If
    
   .SelStart = 0
   .SelLength = Len(.Text)
   .SelStart = 0
    Label1(X).Tag = sText

   End With

End Sub

I need to keep the Masked Edit control. 

If anybody can help with suggestion, tips, it is you Guru's of All-
Knowing Knowledge and Expertise.

I would really appreciate your help.

Thanks in advance,

vbprogwb







'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to