I am trying to write a query that checks whether certain criterias are met in new data that i am importing and based on different conditions which are explained below it then displays a text :
1ST CONDITION: If the Internal Part Number and Revision match that of a pre-existing table in the database then the text displays: In The Database
2ND CONDITION: If the Internal Part Number matches but the Revision does not match that that of the pre-existing table in the database then the text displays : Revision Change
3RD CONDITION: If the Internal Part Number and the Revision does not match that of the pre-existing table in the database then the text displays : Not In The Database
This is the sql that i wrote to help execute this,it works for the first condition but it does not work in the second condition at all
The CM52 Parts is table that i am importing new data into whilst the Details Table already exists (The table that holds all my pre-existing data)
For some weird reason for conditions when the internal part number match and the revision does not match it displays Not In Database instead of Revision Change
I have tried a variety of options but none seem to work..
P:S:I am not using a Nz operator because none of my data invloves null values
Any assistance you can offer would be much appreciated
1ST CONDITION: If the Internal Part Number and Revision match that of a pre-existing table in the database then the text displays: In The Database
2ND CONDITION: If the Internal Part Number matches but the Revision does not match that that of the pre-existing table in the database then the text displays : Revision Change
3RD CONDITION: If the Internal Part Number and the Revision does not match that of the pre-existing table in the database then the text displays : Not In The Database
This is the sql that i wrote to help execute this,it works for the first condition but it does not work in the second condition at all
The CM52 Parts is table that i am importing new data into whilst the Details Table already exists (The table that holds all my pre-existing data)
Code:
IIf([CM52Parts].[Internal Part Number]=[Details].[Internal Part Number] And [CM52Parts].[Revision] Is Null Or Not [Details].[Revision],"Revision Change.", IIf([CM52Parts].[Internal Part Number]=[Details].[Internal Part Number] And [CM52Parts].[Revision]=[Details].[Revision]," In Database.","Not In Database.")) AS DisplayText,
I have tried a variety of options but none seem to work..
P:S:I am not using a Nz operator because none of my data invloves null values
Any assistance you can offer would be much appreciated
Comment