Using column property in combo box

Consonanza

New member
Local time
Today, 02:29
Joined
Jan 7, 2022
Messages
13
On my data entry form I select a value from combo "cboFormat"

Its columns are fldFormatID |fldFormat|fldSortOrder

Sample data looks like this:

1|CD|1
2|2CD|2
3|3CD|3
4|LP|4
5|2LP|5
6|45|6
etc etc

fldFormatID is the bound column

On a separate field in the form, I have a control called fldClass which I want to be automatically updated after cboFormat is selected.
The after_update code look like this

Code:
Select Case Me!cboFormat.Column(1)
      
 Case Is = "*CD"
            Me!fldMasterFormat = "CD"
            Me!fldClass = "C"

 Case Is = "*LP"
            Me!fldMasterFormat = "LP"
            Me!fldClass = "L"

 Case Is = "45"
            Me!fldMasterFormat = "45"
            Me!fldClass = "S"

End select

Whilst the value selected for me!cboFormat is correctly identified, the case selection does not and the code just skips through.
 
Can't test this right now but maybe try something like:
Code:
Dim strCbo As String

strCbo = Me!cboFormat.Column(1)

Select Case True
   Case strCbo Like "*CD"
     ...
   Case strCbo Like "*LP"
     ...
End Select
Hope that helps...
 
you could also use
Code:
Select Case Right(Me!cboFormat.Column(1),2)

Case "CD"

Case "LP"

Case "45"

Case Else

End select
 

Users who are viewing this thread

Back
Top Bottom