A text box question: tricky

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Danny

    A text box question: tricky

    I have a text box that is bound to a field in a database

    1. How do I prevent edit of this field from data entry, but allow a user to
    change this by selecting from a combo box?
    (the combobox has this field in the control source, and looks up records
    from another table)
    Right now I do it by disabling the control, but that causes the color to be
    grayed out.

    What do you suggest?



  • Mike Preston

    #2
    Re: A text box question: tricky

    On Tue, 20 Apr 2004 17:10:45 GMT, "Danny" <dannywork5@hot mail.com>
    wrote:
    [color=blue]
    >I have a text box that is bound to a field in a database
    >
    >1. How do I prevent edit of this field from data entry, but allow a user to
    >change this by selecting from a combo box?
    >(the combobox has this field in the control source, and looks up records
    >from another table)
    >Right now I do it by disabling the control, but that causes the color to be
    >grayed out.
    >
    >What do you suggest?[/color]

    1) Leave it as it is.

    2) If it isn't going to be edited, don't bind it. Populate the text
    box with the value of the field when the form is opened. Change the
    value of the text box when the combo box is updated.

    3) Enter some code in the control's after update event to restore it
    to the value it was before the user attempted to edit it (yuck!)

    4) Enter some code in the control's before update event to cancel the
    update event. (yuck, but not as bad as (3)

    mike

    Comment

    • fredg

      #3
      Re: A text box question: tricky

      On Tue, 20 Apr 2004 17:10:45 GMT, Danny wrote:
      [color=blue]
      > I have a text box that is bound to a field in a database
      >
      > 1. How do I prevent edit of this field from data entry, but allow a user to
      > change this by selecting from a combo box?
      > (the combobox has this field in the control source, and looks up records
      > from another table)
      > Right now I do it by disabling the control, but that causes the color to be
      > grayed out.
      >
      > What do you suggest?[/color]

      If the only real problem is that the color is grayed out, simply set
      the control Locked property to Yes and it's Enabled property to No.
      It will retain it's original color but no one can enter it.
      --
      Fred
      Please only reply to this newsgroup.
      I do not reply to personal email.

      Comment

      • Bradley

        #4
        Re: A text box question: tricky

        Danny wrote:[color=blue]
        > I have a text box that is bound to a field in a database
        >
        > 1. How do I prevent edit of this field from data entry, but allow a
        > user to change this by selecting from a combo box?
        > (the combobox has this field in the control source, and looks up
        > records from another table)
        > Right now I do it by disabling the control, but that causes the color
        > to be grayed out.
        >
        > What do you suggest?[/color]

        Simple. Set the Locked property to True as well... then it won't be
        greyed out :)

        --
        regards,

        Bradley


        Comment

        Working...