Problem with IF statement?

Gavx

Registered User.
Local time
Tomorrow, 04:17
Joined
Mar 8, 2014
Messages
155
On a subform's Current and After Update event I have this code;

Code:
'Change title of Date out/In labels depending on Product Type
        If Me.cbProductName.Column(2) <> "3" Then
            Me.lblDateIn.Caption = "Date"
            Me.lblDateOut.Caption = " "
            
        End If

It's purpose is to change the label headings (in datasheet view) depending on the value of cbProductName.Column(2). However it is not working and I suspect the problem is in the
If Me.cbProductName.Column(2) <> "3" Then​
part.

What have I missed?

Note that I also have this event;
Code:
'Skip over Date Out column
    Me.txtDateOut.Enabled = Me.cbProductName.Column(2) = "3"

that is working, so I know that the Me.cbProductName.Column(2) is correct.
 
Think I might know the problem.

There needs to be statement that sets the label caption to their default value.

How would a write this?
 
Think I might know the problem.

There needs to be statement that sets the label caption to their default value.

How would a write this?

I'm not sure it's possible to directly retrieve a default value of a control's caption.

On form opening, have a routine to record the control's caption. In your code snippet, just add an ELSE part and retrieve your default caption from what was recorded at form opening.
 

Users who are viewing this thread

Back
Top Bottom