Invalid query

Luca Tramontana 81 Reputation points
2022-04-21T09:41:06.817+00:00

Dear all,

I'm getting the below on error on this code:

Sub GetPidVersionTwo()  
    Dim objSWbemServices As Object  
    Dim colSWbemObjectSet As Object  
    Dim objSWbemObject As Object  
    Dim StrComputer As String  
    Dim RstProcess As ADODB.Recordset  
    Dim CommandLineToSearch As String  
    Dim StrExecQuery As String  
    StrComputer = "."  
    StrExecQuery = "SELECT ProcessID, Name, CommandLine FROM Win32_Process WHERE Name = 'MSACCESS.EXE' and CommandLine Like '%D:\Database\Sample.accdb%'"  

195078-invalidquery.png

I'm sure the issue is on the path D:\Database\Sample.accdb; any way to fix it?

Thanks

Community Center | Not monitored
0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.