Combo Box Issue

g3machining

New member
Local time
Yesterday, 23:39
Joined
Nov 16, 2016
Messages
4
Hello,

I posted this issue earlier, but in the wrong area.

I have a form that I am using a combo box to input values from a table.

To be more specific it is customer contact information.

Once the data is input from the combo box I want to disable the ability to select a different customer.

I looked up the code to do this, however it locks to selection all all records.

I am trying to enter a code that if their is a value in the combo box already to lock it out, which would allow a null value in a new record to still be selected.

I am using the AfterInsert even with the following code

If Me.cboContact.Value = "" Then
Me.cboContact.Locked = True
End If

I tried to replace "" with =Is Not Null

What am I doing wrong here?

Am I even going about this the right way?

Thanks in advance!

Brandon
 
zero length string plus null equals zero length string

"" = "" equals true

So if the control doesn't have a value...

cboContact.Locked = "" & cboContact.Value = ""

and if it does have a value...

cboContact.Locked = "" & cboContact.Value <> ""
 
I would use the current event and test for new record:

Me.cboContact.Locked = Not Me.NewRecord
 

Users who are viewing this thread

Back
Top Bottom