Textbox and Combobox on the Same Column

  • Thread starter Thread starter rudy
  • Start date Start date
R

rudy

Hi All,

The thing i want to do is the combobox or textbox will be used is depend on
the row.

Here is for example.
I assume I have one hidden field, I named ROW_TYPE, if the value of that
field is TB, so Texbox will be used, and Combobox for others.

Is it possible to achieve that in Ms Access 2000/2002?


Thank in advance,
Rudy
 
Rudy,

It's easy enough, but I have to ask what sort of data is likely to be stored
in the field that both control types will use?

Assuming both controls contain the same data, then to set it up, place the
textbox and combo box in exactly the same place, then add the following code
to the form's Current event:
Private Sub Form_Current()
Me.txtTextBox.Visible = (UCase(Me.ROW_TYPE) = "TB")
Me.cboComboBox.Visible = Not (UCase(Me.ROW_TYPE) = "TB")
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Hi Graham, Thanks.

Graham R Seach said:
Rudy,

It's easy enough, but I have to ask what sort of data is likely to be stored
in the field that both control types will use?
Actually i try to minimize data typing by user, there are 2 types of data
but stored in the same column as character data type, the first type is
constant that contains only yes or no (may be i can use checkbox too), and
the second one is manually key in.

Before updating this change to database (Sqlserver 2k), I will validate it
first.

I'll consider to use your approach but if it's possible to change
dynamically from one control type to another at runtime, I'll consider this
one.

Thank in advance,
Rudy
 
Back
Top