Conditional VBA If Statement per row (1 Viewer)

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:26
Joined
May 7, 2009
Messages
19,247
change this portion to:
Code:
Switch(IsNull(TBLALLHRDetails.HRReferenceNumber + TBLALLHRDetails.OCCReferenceNumbers) Or
        TBLALLHRDetails.HRReferenceNumber="N/A" Or
        TBLALLHRDetails.OCCReferenceNumbers = "N/A", Null,
        TBLALLHRDetails.HRReferenceNumber <> TBLALLHRDetails.OCCReferenceNumbers, "Do Not ",
         True, "They ") + "Match" As RefStatus
 

stu_c

Registered User.
Local time
Today, 23:26
Joined
Sep 20, 2007
Messages
489
so the "N/A", Null, the null it here is the actual outcome of what will show?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:26
Joined
May 7, 2009
Messages
19,247
Null, the null it here is the actual outcome of what will show?
the output is Null. and Null means "nothing", so you will see blank/nothing.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 23:26
Joined
Sep 12, 2006
Messages
15,660
Hi All
I have a Table in a form with multiple fields I am trying to do an IF Statement that if two fields do not Match then the status Text box Box reads "DO NOT MATCH", on after update of the field, I have managed to do it but the issue I am having is that it also updates the other entries, is there a way to do the IF Statement per entry rather than overall?

Obviously Once I have figured this out then I can make Multiple IF statements for what I need but cannot work out why its doing it

Basically I did the top one and showed as THEY MATCH but when I tried the second entry it changed both

Code:
Public Function Func_ReferenceStatus()
    If [Forms]![FRM_TBLALL_Details]![SSFRM_TBLALL_HRDetails].[Form]![TXTHRReferenceNumber] <> _
    [Forms]![FRM_TBLALL_Details]![SSFRM_TBLALL_HRDetails].[Form]![TXTOCCReferenceNumbers]Then

    [Forms]![FRM_TBLALL_Details]![SSFRM_TBLALL_HRDetails].[Form]![TXTReferenceStatus] = "DO NOT MATCH"


Else
     [Forms]![FRM_TBLALL_Details]![SSFRM_TBLALL_HRDetails].[Form]![TXTReferenceStatus] = "THEY MATCH"

End If
End Function

View attachment 106216

This may already have been asked, but why do you get to a situation where you are trying to compare two values like this? It sort of indicates that there is somethnig amiss with the table design.
 

Users who are viewing this thread

Top Bottom