Re: Unbound Combobox

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Tue, 20 May 2008 11:09:01 -0700, Martin wrote:

I have an unbound combobox control that uses a table as the RowSource, it is
bound to Column 1. I have the Limit To List property set to Yes, but the
user can still bypass the data entry into this box leaving it empty/null.

I have tried using the NotInList event, but that does not prevent leaving
the control empty. Access Help for a Bound combobox suggests using the
Required property of the field, but since my control is unbound, there does
not appear to be a Required property.

Basically, I want to make sure an entry is made and that it matches one of
the values in the pulldown.

Does anyone have any suggestions on how to accomplish this?

Thanks.

Use the Combo NotInList event to require an in-list value selection.

Then to not allow a blank (Null) value, code the Form's BeforeUpdate
event to display a message, cancel the record update, and set focus to
the combo box.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.ComboName) Then
MsgBox "You cannot leave this Combo Box blank."
Cancel = True
Me.ComboName.SetFocus
End If

End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
.



Relevant Pages

  • Re: Null as Default Value
    ... Leaving the Default Value property empty for a text field will produce a ... Null value in that field if no other data entry is made into that field. ... Am I missing something here or has it ...
    (microsoft.public.access.tablesdbdesign)
  • format data displayed on Excel data entry form
    ... However, after the leaving the record and returning to it, the data entry ... form displays the times using AM/PM rather than 24 hour format, ... Can I cause the data entry form to use my desired format? ...
    (microsoft.public.excel.setup)