Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 6th, 2007, 10:46 AM
Authorized User
 
Join Date: Jun 2005
Posts: 42
Thanks: 0
Thanked 1 Time in 1 Post
Default

Sorry again,

I got an error on Line 10 Char 10 Error: Subscript out of range: 'i'

This script is giving me the Login ID of all the people that have logged into this machine. Not the current logged user. What I need is to determined who is the current user Login ID.

arnniema
 
Old March 6th, 2007, 10:50 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I think you may be getting all the people who have logged into your network, since you are probably running this with administrative privileges. Try running this on just the local machine and see what you get.

The reason the array is out of range is that there are too many user names trying to get into the array. Set the range to (100) or (1000) and see if you can get them all in there.


mmcdonal
 
Old March 6th, 2007, 11:06 AM
Authorized User
 
Join Date: Jun 2005
Posts: 42
Thanks: 0
Thanked 1 Time in 1 Post
Default

I HAVE INCREASED THE ARRAY TO 100. I WANT TO REMIND YOU THAT THE ADMINISTRATOR WILL RUN THE SCRIPT AT HIS LOCAL WORKSTATION TO DETERMINE WHO IS LOGGED IN AT A REMOTE WORKSTATION. HOWEVER, WHEN I RUN THE SCRIPT IT REPEACT ALL THE OLD LOGGED ID USERS IN ADDITON TO THE CURRENT USER. WHEN I RUN IT AT MY LOCAL PC ENTERING MY PC'S NAME IT GIVE ME JUST MY LOGIN ID.

arnniema
 
Old March 6th, 2007, 05:05 PM
Authorized User
 
Join Date: Jun 2005
Posts: 42
Thanks: 0
Thanked 1 Time in 1 Post
Default

Dear Michael:

can you help me this issue?

arnniema
 
Old March 7th, 2007, 08:23 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

As I say, I think the problem with this is that if you are an administrator, you will get ALL the logins on your network when you run this, no matter which PC you specify.

Perhaps a local solution might work better. Like a small srcipt that runs when the user logs in and posts their login to a SQL table, for example.

Other than that, I am not sure how to resolve this since it is more an administrator issue, and not a developer issue. Sorry for that. Perhaps if you look up the "Scripting Guys" at www.microsoft.com.

mmcdonal
 
Old March 7th, 2007, 09:54 AM
Authorized User
 
Join Date: Jun 2005
Posts: 42
Thanks: 0
Thanked 1 Time in 1 Post
Default

I found the solution at the following link: http://www.scriptmob.com/vbscript/vb...er_script.html

Thank you for all your help!!!

arnniema
 
Old March 7th, 2007, 10:02 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Nice, instead of "SELECT * FROM Win32_Environment", use "Win32_ComputerSystem".

mmcdonal









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.