473,756 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Classic "Who is logged-on" problem...

I have a form that I choose from a list of database names and a list
within a textbox comes up with the computer ID number and an associated
(from a table) user name. Is there a way from looking at this code to
tell the network ID name? I hope not to have to write the code with the
"Dev Ashish" API code, which I'm sure is great but I can't figure out
how to implement it in a form like mine. Please look at the below code
and tell if I can modify it to give network ID. I'm using A2000 and
without access security in place.
Thanks!

Option Compare Database
Option Explicit
Private Const ms_UNKNOWN As String = "Unknown User"

Private Function CreateListHeade r() As String
Dim strFill As String
strFill = "No.;Comput er ID;User Name;Connected? ;Suspect State?;"
CreateListHeade r = strFill
End Function

Private Sub cboDBName_Chang e()
Dim strDB As String
Dim strMsg As String
If IsBlank(Me.cboD BName) Then
strMsg = "Unable to perform operation without a valid database
name."
MsgBox strMsg, vbInformation, "Database Name is Blank"
Exit Sub
Else
strDB = Me.cboDBName
ShowUsersInDB (strDB)
End If

End Sub

Private Sub cboDBName_Click ()
Dim strDB As String
Dim strMsg As String
strDB = Me.cboDBName
ShowUsersInDB (strDB)
End If

End Sub

Private Sub ShowUsersInDB(B yVal strDB As String)
Dim cnn As New ADODB.Connectio n
Dim rec As ADODB.Recordset
Dim fld As ADODB.Field
Dim intUser As Integer
Dim intFldCount As Integer
Dim varVal As Variant
Dim strPC As String
Dim strUser As String
Dim strConnected As String
Dim strSuspect As String
Dim strData As String
Dim strInfo As String

'get the db name
strFile = GrabDBPath(strD B)

DoCmd.Hourglass True
'if it gets here - see who is in the database
strData = CreateListHeade r
strFile = strFile & strDB & DB_EXT

'open the connection and recordset
cnn.Open JET_PROVIDER & "Data Source=" & strFile & ";"
Set rec = cnn.OpenSchema( Schema:=adSchem aProviderSpecif ic,
SchemaId:=adhcU sers)

With rec
Debug.Print rec.RecordCount
Do Until .EOF
intUser = intUser + 1
strNo = CStr(intUser) & ";"
intFldCount = 0
For Each fld In .Fields
intFldCount = intFldCount + 1
varVal = fld.Value
Select Case intFldCount
Case 1
strPC = StripNullChar(v arVal)
Case 2 'get the user name for the ID
If IsNull(varVal) Then
strUser = ms_UNKNOWN & ";"
Else
strUser = GrabUserName(st rPC)
End If
Case 3
strConnected = StripNullChar(v arVal)
Case 4 'suspected state
If IsNull(varVal) Then
strSuspect = "False" & ";"
Else
strSuspect = StripNullChar(v arVal)
End If
End Select
Next
strData = strData & strNo & strPC & strUser & strConnected
& strSuspect
.MoveNext
Loop
End With

Me.lstUsers.Row Source = strData

rec.Close
Set rec = Nothing
Set fld = Nothing
Set cnn = Nothing
End Sub

Private Function GrabUserName(By Val strPCID As String) As String

Dim cnn As New ADODB.Connectio n
Dim cmd As ADODB.Command
Dim rec As ADODB.Recordset
Dim strSQL As String
Dim strUser As String

Set cnn = CurrentProject. Connection
Set cmd = New ADODB.Command

strSQL = "SELECT * FROM tblUserIDs WHERE PCID Like '" &
Left$(strPCID, Len(strPCID) - 1) & "'"

cmd.ActiveConne ction = cnn
cmd.CommandType = adCmdText
cmd.CommandText = strSQL

Set rec = cmd.Execute

If Not rec.EOF Then
strUser = rec(1)
Else
strUser = ms_UNKNOWN
End If

rec.Close
cnn.Close
Set cnn = Nothing

End Function

Apr 24 '06
10 3100
Actually I have done it a couple of ways.

On one of my apps I added the following to the onopen event and it
works fine.

=============== ===============
'V:\TEAM FOLDERS\Kelly's Team\EMEA MACD BR Pilot\EMEA MACD PROJ\EMEA
DB\EMEA DB Tables.mdb
Me.txtDBPath = "V:\SHARE FOLDER\Billing Validation\Bill ing Validation
Tables.mdb"
' If Len(.Value) Then
' Me.chkUserRoste r.Enabled = fIsJet4DB(.Valu e)
Me.chkUserRoste r.Enabled = True
Call cmdExecute_Clic k
' End If
=============== =============== =============== =========

Apr 27 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5500
by: Vik Rubenfeld | last post by:
I'm a newbie to Apache. This week I installed my first Apache 2.0 server, and it's working fine. I then installed PHP. When I ran the PHP test file ("test.php"), the actual text contents of the file came up in the browser: ---------------- <?php phpinfo(); ?> ----------------
99
6228
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a small or mid-sized business. http://groups-beta.google.com/group/microsoft.public.msdn.general/browse_thread/thread/9d7e8f9a00c1c7da/459ca99eb0e7c328?q=%22Proposed+MSDN+subscription+changes%22&rnum=1#459ca99eb0e7c328 Damn! To be that...
0
364
by: gswitz | last post by:
I have written a Windows Service that watches a Lotus Notes InBox for emails, detaches attachments from the emails and attaches them to a different Lotus Notes Database. The service works properly until I log off of the server. At that point, this call begins returning nothing - not an error - just nothing... LnView_Mail = LnDb_Mail.GetView("($InBox)") Once this problem begins, logging back into the server does not resolve it.
6
3040
by: Fan Ruo Xin | last post by:
Last monday, I tried to create a working table, and failed because of 'Log Full'. There were two applications running at that time - one is autoload (during the split phase), another one is "insert into a (NLI) ... SELECT ... FROM ...". I checked the db2diag.log (level=4) and notification file. It was interesting that there was no any information about log full. I had to kill the autoload process. I haven'g got time to see if I can...
1
7252
by: DB_2 | last post by:
Greetings, I was searching Google for ways to turn off transaction logging for some queries. I came across this old post from Feb 2003: > From: fareeda (fareeda@pspl.co.in) > Subject: Re: Question related to "CREATE TABLE AS SELECT" in DB2 > Newsgroups: comp.databases.ibm-db2 > Date: 2003-02-27 21:11:59 PST >
1
5488
by: Daniel Chou | last post by:
Hello, I have two questions about "not logged initially": 1. Before using "alter table tbname activate not logged initially", should the table be created with "not logged initially"? 2. After using "alter table tbname activate not logged initially", how to deactivate it?
5
2868
by: Dan C Douglas | last post by:
I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002. When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90. For example... ? dr("CostsPerBin") returns
3
5863
by: aydeejay | last post by:
I'm trying to troubleshoot an issue where users are not able to bind with LDAP via "GetObject" through our ASP Classic Intranet if they stay logged in overnight (beyond their allowed login hours). The problem does not occur when performing the same bindings using a logon script. So, the user logs in, is able to perform queries all day, and then fails to log out at the end of the day. We'd prefer that they did log out nightly, but it...
0
1342
by: =?Utf-8?B?cmZsYXphcm8=?= | last post by:
Hi All, We are trying to build an automation utility to configure OS. I found a way to automate the process below via registry: Control Panel -Taskbar and Start Menu ->Start Menu Tab --Select "Classic Start Menu". Click Apply. Click OK HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer DWORD Value name Value Data
1
1907
by: =?Utf-8?B?SkI=?= | last post by:
Greetings, I am getting an "Access is denied" Error when calling objects from the AdminIndexServerClass from an ASP.NET application. I use this object to perform a simple rescan on a Catalog after file are save to the local disk. This only works if the users belongs to the local Admin group. The the web site is setup to use Integrated Windows Authentication and Web.Config is set to (Server 2003/IIS 6.0/ASP 1.1) <authentication...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.