Please help me understand this query (1 Viewer)

SachAccess

Active member
Local time
Today, 11:34
Joined
Nov 22, 2021
Messages
389
Hi,

Could you please help me understand below query.
I am able to run this query without any issues at my desk. I have my own DB for this.
And query is run from another DB.

However another user is facing issues with below query at his machine.
I am not able to understand the reason.
This query is marked with RED cross. I guess this is for Delete.
Am not sure, what exactly will be the impact of this query hence not tried running it manually.
This query is called by a Sub in the DB.
What could be the reason for this query facing issues at user's desk.
FYI, this macro uploads data on SharePoint and user has access to the SharePoint.
Can anyone please help me understand this.


Code:
DELETE tblMyChartAnalysis.*, tblMyChartAnalysis.SubProcessName
FROM tblMyChartAnalysis
WHERE (((tblMyChartAnalysis.SubProcessName) In (Select distinct SubProcessName from tblMyMapping)));
 

CJ_London

Super Moderator
Staff member
Local time
Today, 07:04
Joined
Feb 19, 2013
Messages
16,650
this query will delete all records in tblMyChartAnalysis where the subProcessName exists in tblMyMapping

this part
DELETE tblMyChartAnalysis.*, tblMyChartAnalysis.SubProcessName

only needs to be

DELETE *

with regards why it won't run work for another user. could be many things - tables and/or field names are different or don't exist spring to mind. All depends on what the error message is

don't see anything that uploads the data to sharepoint in what you have provided
 

isladogs

MVP / VIP
Local time
Today, 07:04
Joined
Jan 14, 2017
Messages
18,255
I believe this will achieve the same result:

Code:
DELETE DISTINCTROW tblMyChartAnalysis.*
FROM tblMyChartAnalysis INNER JOIN tblMyMapping
ON tblMyChartAnalysis.SubProcessName=tblMyMapping.SubProcessName;

The DISTINCTROW is used to ensure unique records. It may not be necessary depending on your tables
 

SachAccess

Active member
Local time
Today, 11:34
Joined
Nov 22, 2021
Messages
389
this query will delete all records in tblMyChartAnalysis where the subProcessName exists in tblMyMapping

this part
DELETE tblMyChartAnalysis.*, tblMyChartAnalysis.SubProcessName

only needs to be

DELETE *

with regards why it won't run work for another user. could be many things - tables and/or field names are different or don't exist spring to mind. All depends on what the error message is

don't see anything that uploads the data to sharepoint in what you have provided
Thanks a lot for the help. Really sorry for late reply. Was away due to some emergency.
 

SachAccess

Active member
Local time
Today, 11:34
Joined
Nov 22, 2021
Messages
389
I believe this will achieve the same result:

Code:
DELETE DISTINCTROW tblMyChartAnalysis.*
FROM tblMyChartAnalysis INNER JOIN tblMyMapping
ON tblMyChartAnalysis.SubProcessName=tblMyMapping.SubProcessName;

The DISTINCTROW is used to ensure unique records. It may not be necessary depending on your tables
Thanks a lot for the help. Really sorry for late reply. Was away due to some emergency.
 

Users who are viewing this thread

Top Bottom