Enable a subform after any selection is made in a combo box

  • Thread starter Thread starter lsb
  • Start date Start date
L

lsb

I have a subform "BHUSUBMD" that should remain disabled until an MD
selects their name from a combobox "Seenby". It seems I should use the
On Dirty event but I don't know how the code should look.

I've tried this:

Private Sub SEENBY_Dirty(Cancel As Integer)
Me.Dirty = False

If Me.SEENBY.Value = True Then
BHUSUBMD.Enabled = True
Else
BHUSUBMD.Enabled = False
End If

End Sub

But it's definitely not correct.

Can anyone help?

Thanks,
LB
 
Thanks for responding - have tried it and it's not functioning as
expected. My subform doesn't enable after selecting a item in the
box...
Any further advice?

Best,
LB
 
Post the RowSource of your combo box; if it's a query, post the SQL
statement. Also identify the bound column value for the combo box. Is the
combo box bound to a field; if yes, what is the datatype of that field? Is
BHUSUBMD the name of the subform control (the control that holds the subform
source object)
 
Here's the info you asked for:

The RowSource of the combo box is part of a query:
SELECT HVHPMDLIST.ID, HVHPMDLIST.MDName FROM HVHPMDLIST ORDER BY
HVHPMDLIST.MDName;

The bound column value for the combobox is 2

The combo box is bound to a field - it is a Text field

BHUSUBMD is the name of the subform control

Thanks,
LB
 
OK. The query is not giving you a "True/False" value in the bound column. So
let's change the code to this:

Private Sub SEENBY_AfterUpdate()
Me.Dirty = False
BHUSUBMD.Enabled = (Len(Me.SEENBY.Value & """) > 0)
End Sub
 
Ken,
Thank you! The code had one too many "s in it, so I removed one and it
works just great.

LB
 
Back
Top