Disabling of the combo box

  • Thread starter Thread starter Swati
  • Start date Start date
S

Swati

Hi,

Several Controls like combo box, text box are placed in
the single row in the detail section of the form.
As soon as first control is updated a new row in created
in the form.
Now I want to disable the combo box for suppose first two
rows and same control should be enabled for the last row
(i.e the new row generated).
But the problem that i'm facing is that it takes the combo
box as a single control and disable it for all the rows.

Thanks
Swati
 
By your description, this sounds as if you have the form in "continuous
form" view and the new line is where you will enter a new record. The
problem occurs because there is really only one combobox on the form, it is
just displayed multiple times (once for each record).

You can enable/disable the combobox by whether or not you are at a new
record. It will "appear" on the form as if it is enabled or disabled for all
records. However, you can't make any changes in it without going to the
record first, at which point it would become disabled.

To do this, use the form's Current event.

If Me.NewRecord = True Then
Me.cboMyCombo.Enabled = True
Else
Me.cboMyCombo.Enabled = False
End If

or if you prefer less typing (but a little harder to understand), this will
do the same thing.

Me.cboMyCombo.Enabled = Me.NewRecord
 
Back
Top