Hi! sxschech
Below query is to identify for one user Id and replace it in Source field without looking for the Table, "tblDeptName"
I am not able to join all the queries together and replace it in the source.
will this be possible under one single query
BR:
SELECT tblUpdate.Source, tblUpdate.UserId, tblUpdate.UserCode
FROM tblUpdate
WHERE (((tblUpdate.Source)=IIf(IsNull([tblUpdate].[Source]),"BR",[tblUpdate].[Source])) AND ((tblUpdate.UserId) Is Null And ((tblUpdate.UserId) Is Null Or (tblUpdate.UserId) Like "*[!((E) or (0-9))]*") And ((tblUpdate.UserId)="isnull" Or (tblUpdate.UserId) Like "*[!((tgbr) or (000-999))]*")) AND ((tblUpdate.UserCode) Not Like 3 And (tblUpdate.UserCode) Not Like 99)) OR (((tblUpdate.UserId) Not Like "SystemUser" And ((tblUpdate.UserId)="isnull" Or (tblUpdate.UserId) Like "*[!((E) or (0-9))]*") And ((tblUpdate.UserId) Is Null Or (tblUpdate.UserId) Like "*[!((TGBR) or (000-999))]*")) AND ((tblUpdate.UserCode) Not Like 3 And (tblUpdate.UserCode) Not Like 99));
TGBR:
SELECT tblUpdate.Source, tblUpdate.UserId
FROM tblUpdate
WHERE (((tblUpdate.Source)=IIf(IsNull([tblUpdate].[Source]),"TGBR",[tblUpdate].[Source])) AND ((tblUpdate.UserId) Is Null)) OR (((tblUpdate.UserId) Not Like "*[!((TGBR) or (000-999))]*"));
CL:
SELECT tblUpdate.Source, tblUpdate.UserId, tblUpdate.UserCode
FROM tblUpdate
WHERE (((tblUpdate.Source)=IIf(IsNull([tblUpdate].[Source]),"CL",[tblUpdate].[Source])) AND ((tblUpdate.UserId) Is Null And ((tblUpdate.UserId) Is Null Or (tblUpdate.UserId) Like "*[!((E) or (0-9))]*") And ((tblUpdate.UserId)="isnull" Or (tblUpdate.UserId) Like "*[!((TGBR) or (000-999))]*")) AND ((tblUpdate.UserCode) Like 3 And (tblUpdate.UserCode) Like 99)) OR (((tblUpdate.UserId) Not Like "SYST" And ((tblUpdate.UserId)="isnull" Or (tblUpdate.UserId) Like "*[!((E) or (0-9))]*") And ((tblUpdate.UserId) Is Null Or (tblUpdate.UserId) Like "*[!((TGBR) or (000-999))]*")) AND ((tblUpdate.UserCode) Like 3 And (tblUpdate.UserCode) Like 99));
CP:
SELECT tblUpdate.Source, tblUpdate.UserId, tblUpdate.UserCode
FROM tblUpdate
WHERE (((tblUpdate.Source)=IIf(IsNull([tblUpdate].[Source]),"CP",[tblUpdate].[Source])) AND ((tblUpdate.UserId) Is Null And ((tblUpdate.UserId) Is Null Or (tblUpdate.UserId) Like "*[!((E) or (0-9))]*") And ((tblUpdate.UserId)="isnull" Or (tblUpdate.UserId) Like "*[!((TGBR) or (000-999))]*")) AND ((tblUpdate.UserCode) Like 3 And (tblUpdate.UserCode) Like 99)) OR (((tblUpdate.UserId) Not Like "SYST" And ((tblUpdate.UserId)="isnull" Or (tblUpdate.UserId) Like "*[!((E) or (0-9))]*") And ((tblUpdate.UserId) Is Null Or (tblUpdate.UserId) Like "*[!((TGBR) or (000-999))]*")) AND ((tblUpdate.UserCode) Like 3 And (tblUpdate.UserCode) Like 99));
CO:
SELECT tblUpdate.Source, tblUpdate.UserId, tblUpdate.UserCode
FROM tblUpdate
WHERE (((tblUpdate.Source)=IIf(IsNull([tblUpdate].[Source]),"CO",[tblUpdate].[Source])) AND ((tblUpdate.UserId) Is Null And ((tblUpdate.UserId) Is Null Or (tblUpdate.UserId) Like "*[!((E) or (0-9))]*") And ((tblUpdate.UserId)="Is Null" Or (tblUpdate.UserId) Like "*[!((TGBR) or (000-999))]*")) AND ((tblUpdate.UserCode) Like "SYST")) OR (((tblUpdate.UserId) Not Like "SYST" And ((tblUpdate.UserId)="Is Null" Or (tblUpdate.UserId) Like "*[!((E) or (0-9))]*") And ((tblUpdate.UserId) Is Null Or (tblUpdate.UserId) Like "*[!((TGBR) or (000-999))]*")) AND ((tblUpdate.UserCode) Is Null));
CD:
SELECT tblUpdate.Source, tblUpdate.UserId, tblUpdate.UserCode
FROM tblUpdate
WHERE (((tblUpdate.Source)=IIf(IsNull([tblUpdate].[Source]),"CD",[tblUpdate].[Source])) AND ((tblUpdate.UserId) Is Null And ((tblUpdate.UserId) Is Null Or (tblUpdate.UserId) Like "*[!((E) or (0-9))]*") And ((tblUpdate.UserId)="Is Null" Or (tblUpdate.UserId) Like "*[!((TGBR) or (000-999))]*")) AND ((tblUpdate.UserCode) Not Like "* [!((E) or (0-9))]*"));