Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Posts
    18

    Unanswered: -

    -
    Last edited by TheGame7; 12-10-03 at 10:42.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Check the properties of the textbox ... Locked, Back Color, and Special Effect.

  3. #3
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    .Locked
    .BackColor
    .SpecialEffect (= 2)

    For your red/black question, you can't (that I know of) do this with continuous forms and get the result you would expect (visibly red and black between records). Use Form_Current.

    For any other properties you need to set, most of the ones on the properties window for a control (F4) are available as object properties in the project window. Just use textbox1. and look at what you can get.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    If you want to unlock a specific control in your form like a text box you would so such

    Code:
    Me.myTextBox.Locked = False
    Where you put this code is entirely up to you (you have to be a little more specific with what you're trying to accomplish). Perhaps in the 'OnClick' event of a button control.

    To Change the backgound color and make the text box sunken, you might want to place that code into the 'GotFocus' event of the text box in question:

    Code:
    Me.myTextBox.BackColor = vbCyan  'To change the color
                  
                   OR
    
    Me.myTextBox.BackColor = 16776960  'To change the color
    
                  AND
    
    Me.myTextBox.SpecialEffect = 2  'To make the TextBox Sunken
    
    Here are the different effects for the 'SpecialEffect' Property:
    
    Flat		0
    Raised		1
    Sunken		2
    Etched		3
    Shadowed	4
    Chiseled 	5
    Last edited by CyberLynx; 12-08-03 at 13:35.

  5. #5
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Game, I think you and CyberLynx posted at the same time. Cyber shows how to do this (Me.txtCustomerNumber.Locked = True)
    All code ADO/ADOX unless otherwise specified.
    Mike.

  6. #6
    Join Date
    Nov 2003
    Posts
    1,487
    In my opinion... the .Locked property is an unfaithfull property (sometimes it locks and sometimes it does'nt). It may be a good idea to place your entry password into public variable (dim'ed in the declarations section of your form):

    Code:
    Option Compare Database
    Option Explicit
    Dim strInput As String
    and in the 'KeyDown' event of your Customer Number entry box you put:

    Code:
    Private Sub txtCustomerNumber_KeyDown(KeyCode As Integer, Shift As Integer)
      If strInput <> "Pattni1485" Then KeyCode = 0: Exit Sub
    End Sub

    As for the Red/Black thingy...well I'll just poke at it here. Most often conditions change from record to record therefore you MAY want to place something like this little piece of code into the 'OnCurrent' event of your display form:

    Code:
    If WhatEverCondition then
      Me.txtCustomerNumber.ForeColor = vbRed
    Else
      Me.txtCustomerNumber.ForColor = vbBlack
    End If
    
         O R 
    
    Dim MyColor As Long
    Select Case WhatEverCondition
       Case 1
            MyColor = VbBlue
       Case 2
            MyColor = vbRed
       Case 3
            MyColor = vbCyan
       Case 4
            MyColor = vbBlack
       'etc....
       'etc....
    End Select
    Me.txtCustomerNumber.ForeColor = MyColor
    Hmmmm...... That should do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •