Typically this is because the bound column of the combobox does not have the value you've tested for...
I would suspect that the combobox has 2 or more columns.
The first column has the primary key such as 1, 2, 3...
The second column has the text such as Hello; Hail; Aloha... which is what the user sees.
The bound column is 1 for the control (set in the properties)
So in my example.. "2 = Hail" there are a couple of ways to fix this... so try this code (change the number to match your data)
- Option Compare Database
-
Option Explicit
-
-
Private Sub POI_AfterUpdate()
-
Dim z_lng_cbobox_poi As Long
-
'
-
'Need an error trap?
-
'
-
'Get the value from the form control
-
z_lng_cbobox_poi = Me.POI.Value
-
'
-
'check to see what the value was and
-
'enable if the user selected the "Hail" entry
-
If (z_lng_cbobox_poi = 2) Then '<<<Note the change
-
Me.Measurements.Enabled = False
-
Else
-
Me.Measurements.Enabled = True
-
End If
-
'
-
'error trap code would go here
-
End Sub