Please help with VBA Code!

  • Thread starter w2wm via AccessMonster.com
  • Start date
W

w2wm via AccessMonster.com

I’m not sure if it is possible what I’m trying to do, but maybe someone out
there will have a little input and take away some of the frustration I’m
having. I would like to include some a code in a model that looks up
different processes that are running on a computer. Here is what I came up
with so far but it doesn’t seem to be working for me. I would have the user
execute one database that will post the data out to another one. Which I have
that working. I just don’t know what code to use to get the task from the
machine. I just want to check and see if 4 different task are running and
place that in a check box. The code only show for one and that is for zanda.
exe I just wanted to get one working before I added the other 3. Please
direct me if I’m doing this completely wrong.

My code is as followed.

Option Compare Database
Function CloseStamp()
DBName = "C:\security.mdb"
TableName = "security"
Dim WorkDB As Database, WorkTable As Recordset, HoldTable As Recordset
Set WorkDB = DBEngine.Workspaces(0).OpenDatabase(DBName)
Set WorkTable = WorkDB.OpenRecordset(TableName, DB_OPEN_TABLE)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!
\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'zanda.exe'")



If colProcessList.Count = 0 Then
colProcessList = True
Else
colProcessList = False

End If

WorkTable.AddNew
WorkTable("Object") = ObjName
WorkTable("Name") = User
WorkTable("Date/Time") = Now
WorkTable("Action") = "close"
WorkTable("Type") = ObjType
WorkTable("ComputerName") = ComP
WorkTable("Zanda") = findme
WorkTable.Update ' Save changes.

End Function

Thank you,

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top