473,668 Members | 2,519 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Log Users both compteted and failed...

I would like to setup a form that will log the users logging in to a
db. The form and the Db will currently log the users if they complete
the logon and get in. It will then log the entry, but not if they
fail to login. If they fail I would like it to log the attempted pass
and the computer name from where they are logging in, the systems are
both win2k and win98 under access 2K.

for ex

User: User1
Pass: password

User gets in
DB shows, user1 pass ComputerName Work2 at 10:00am 09-29-03

User: User2
Pass: fail "entered the wrong pass"

User asked to relogin
DB shows, user2 Failed "fail" ComputerName work1 10:01am 09-29-03
Nov 12 '05 #1
5 2723
Hi Chuck,
This code will only work if the login succeeded, won't it?
I can't think of code that logs the unsucceeded attempts, or am I missing something here?
I also count and log the number of users, machinename and so on, but not for attempts to log in.
Could be interesting though.

Arno R

"Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> schreef in bericht
news:eo******** *************** *********@4ax.c om...

This is my "standard" logging function. Usually I write to a CSV file
rather then to a table in the database. This gets around "permission "
problems, and allows the Network Administrator (or whoever) to take a
look at what's going on with the database without having to give them
a login (and possibly access to data they shouldn't have access to!)

See http://www.mvps.org/access/api/api0008.htm for the code to get the
Network User name and http://www.mvps.org/access/api/api0009.htm for
the code to get the Machine name if you don't already have it.

Public Sub WriteToLog(strL ogEntryText As String, _
Optional strSeperator As String = ",", _
Optional strLogFileName As String = "", _
Optional whatDB As DAO.Database = Nothing)

Dim intFF As Integer
Dim strSQL As String
Dim bolISetTheDB As Boolean

On Error Resume Next

If strLogFileName = "" Then
If whatDB Is Nothing Then
Set whatDB = CurrentDb
bolISetTheDB = True

' if no log name is given, create a log
' in the same location and with the same name
' as the database, but change the ext to '.dat'
strLogFileName = Left$(CurrentDb .Name, _
Len(CurrentDb.N ame) - 4) & _
".dat"
Else
strLogFileName = Left$(whatDB.Na me, _
Len(whatDB.Name ) - 4) & _
".dat"
End If
End If

strSQL = Chr$(34) & Format$(Now()," yyyy-mm-dd hh:nn:ss") & _
Chr$(34) & strSeperator & _
Chr$(34) & CurrentDb.Prope rties("AppTitle ") & _
Chr$(34) & strSeperator & _
Chr$(34) & GetNetworkUserN ame() & _
Chr$(34) & strSeperator & _
Chr$(34) & GetMachineName( ) & _
Chr$(34) & strSeperator & _
Chr$(34) & strLogEntryText & _
Chr$(34)

intFF = FreeFile
Open strLogFileName For Append As intFF
Print #intFF, strSQL
Close intFF

If bolISetTheDB = True Then
whatDB.Close
Set whatDB = Nothing
End If

On Error GoTo 0
End Sub
On 29 Sep 2003 12:43:38 -0700, jo***********@s ocal.rr.com (Josh
Armstrong) wrote:
I would like to setup a form that will log the users logging in to a
db. The form and the Db will currently log the users if they complete
the logon and get in. It will then log the entry, but not if they
fail to login. If they fail I would like it to log the attempted pass
and the computer name from where they are logging in, the systems are
both win2k and win98 under access 2K.

for ex

User: User1
Pass: password

User gets in
DB shows, user1 pass ComputerName Work2 at 10:00am 09-29-03

User: User2
Pass: fail "entered the wrong pass"

User asked to relogin
DB shows, user2 Failed "fail" ComputerName work1 10:01am 09-29-03

--
He Who Laughs Last Thinks Slowest!

Nov 12 '05 #2
I don't believe there's any way to log failed logins. Access doesn't start
running until after the validation process, so you can't use VBA code in
your application to do that kind of logging.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
"Arno R" <ar************ ****@tiscali.nl > wrote in message
news:bl******** *@reader1.tisca li.nl...
Hi Chuck,
This code will only work if the login succeeded, won't it?
I can't think of code that logs the unsucceeded attempts, or am I missing something here? I also count and log the number of users, machinename and so on, but not for attempts to log in. Could be interesting though.

Arno R

"Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> schreef in bericht
news:eo******** *************** *********@4ax.c om...

This is my "standard" logging function. Usually I write to a CSV file
rather then to a table in the database. This gets around "permission "
problems, and allows the Network Administrator (or whoever) to take a
look at what's going on with the database without having to give them
a login (and possibly access to data they shouldn't have access to!)

See http://www.mvps.org/access/api/api0008.htm for the code to get the
Network User name and http://www.mvps.org/access/api/api0009.htm for
the code to get the Machine name if you don't already have it.

Public Sub WriteToLog(strL ogEntryText As String, _
Optional strSeperator As String = ",", _
Optional strLogFileName As String = "", _
Optional whatDB As DAO.Database = Nothing)

Dim intFF As Integer
Dim strSQL As String
Dim bolISetTheDB As Boolean

On Error Resume Next

If strLogFileName = "" Then
If whatDB Is Nothing Then
Set whatDB = CurrentDb
bolISetTheDB = True

' if no log name is given, create a log
' in the same location and with the same name
' as the database, but change the ext to '.dat'
strLogFileName = Left$(CurrentDb .Name, _
Len(CurrentDb.N ame) - 4) & _
".dat"
Else
strLogFileName = Left$(whatDB.Na me, _
Len(whatDB.Name ) - 4) & _
".dat"
End If
End If

strSQL = Chr$(34) & Format$(Now()," yyyy-mm-dd hh:nn:ss") & _
Chr$(34) & strSeperator & _
Chr$(34) & CurrentDb.Prope rties("AppTitle ") & _
Chr$(34) & strSeperator & _
Chr$(34) & GetNetworkUserN ame() & _
Chr$(34) & strSeperator & _
Chr$(34) & GetMachineName( ) & _
Chr$(34) & strSeperator & _
Chr$(34) & strLogEntryText & _
Chr$(34)

intFF = FreeFile
Open strLogFileName For Append As intFF
Print #intFF, strSQL
Close intFF

If bolISetTheDB = True Then
whatDB.Close
Set whatDB = Nothing
End If

On Error GoTo 0
End Sub
On 29 Sep 2003 12:43:38 -0700, jo***********@s ocal.rr.com (Josh
Armstrong) wrote:
I would like to setup a form that will log the users logging in to a
db. The form and the Db will currently log the users if they complete
the logon and get in. It will then log the entry, but not if they
fail to login. If they fail I would like it to log the attempted pass
and the computer name from where they are logging in, the systems are
both win2k and win98 under access 2K.

for ex

User: User1
Pass: password

User gets in
DB shows, user1 pass ComputerName Work2 at 10:00am 09-29-03

User: User2
Pass: fail "entered the wrong pass"

User asked to relogin
DB shows, user2 Failed "fail" ComputerName work1 10:01am 09-29-03

--
He Who Laughs Last Thinks Slowest!


Nov 12 '05 #3
jo***********@s ocal.rr.com (Josh Armstrong) wrote in message news:<b6******* *************** ****@posting.go ogle.com>...
I would like to setup a form that will log the users logging in to a
db. The form and the Db will currently log the users if they complete
the logon and get in. It will then log the entry, but not if they
fail to login. If they fail I would like it to log the attempted pass
and the computer name from where they are logging in, the systems are
both win2k and win98 under access 2K.

for ex

User: User1
Pass: password

User gets in
DB shows, user1 pass ComputerName Work2 at 10:00am 09-29-03

User: User2
Pass: fail "entered the wrong pass"

User asked to relogin
DB shows, user2 Failed "fail" ComputerName work1 10:01am 09-29-03


If ValidateUser(st rUserName, strPassword)=Tr ue Then
LogAttempt(strU sername,Compute rName,Now(),Tru e,"") 'True=blnSucces sful
Else
LogAttempt(strU serName,Compute rName,Now(),Fal se,"Wrong Password")
End if

Child's play.
Nov 12 '05 #4
From the responses I think I need to mention that I am not using the
built-in access control to access. This is a form with in the DB
itself. I can get it to log the logon attempts now, but only the ones
that get into the DB not the ones that fail. I don't seem to able to
get it to create a new record each time the user clicks the "log On"
button.

pi********@hotm ail.com (Pieter Linden) wrote in message news:<bf******* *************** ****@posting.go ogle.com>...
jo***********@s ocal.rr.com (Josh Armstrong) wrote in message news:<b6******* *************** ****@posting.go ogle.com>...
I would like to setup a form that will log the users logging in to a
db. The form and the Db will currently log the users if they complete
the logon and get in. It will then log the entry, but not if they
fail to login. If they fail I would like it to log the attempted pass
and the computer name from where they are logging in, the systems are
both win2k and win98 under access 2K.

for ex

User: User1
Pass: password

User gets in
DB shows, user1 pass ComputerName Work2 at 10:00am 09-29-03

User: User2
Pass: fail "entered the wrong pass"

User asked to relogin
DB shows, user2 Failed "fail" ComputerName work1 10:01am 09-29-03


If ValidateUser(st rUserName, strPassword)=Tr ue Then
LogAttempt(strU sername,Compute rName,Now(),Tru e,"") 'True=blnSucces sful
Else
LogAttempt(strU serName,Compute rName,Now(),Fal se,"Wrong Password")
End if

Child's play.

Nov 12 '05 #5
jo***********@s ocal.rr.com (Josh Armstrong) wrote in message news:<b6******* *************** ****@posting.go ogle.com>...
From the responses I think I need to mention that I am not using the
built-in access control to access. This is a form with in the DB
itself. I can get it to log the logon attempts now, but only the ones
that get into the DB not the ones that fail. I don't seem to able to
get it to create a new record each time the user clicks the "log On"
button.

Say you have a form like this:

UserName: [ ]
Password: [ ]

[Log In] [Cancel]
The cmdLogIn button will do something like the following:

dim blnLoginOK as Boolean
dim rs as dao.recordset
dim db as dao.database

set db=currentdb
'open the table for adding records
set rs=db.opentable ("tblLogons",db OpenTable)

'determine if the password matched
blnLogInOK = ValidateUser(me .UserName,me.Pa ssword)

'Log the attempt, successful or not.
rs.AddNew
rs.Fields("User Name")=Me.UserN ame
rs.Fields("Succ essful")=blnLog InOK
rs.Fields("Time Stamp")=Now
rs.Update

'Clean up
rs.close
set rs=nothing
set db=nothing
Nov 12 '05 #6

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

Similar topics

15
3309
by: Viviana Vc | last post by:
How can I programatically do the equivalent of the following: cacls "C:\Program Files\test" /T /G Everyone:f ? Thanks, Viv
15
347
by: Viviana Vc | last post by:
How can I programatically do the equivalent of the following: cacls "C:\Program Files\test" /T /G Everyone:f ? Thanks, Viv
7
2746
by: Reza | last post by:
Hello The project was working, where I had a domain user registered in the database as a user, and I used that user to connect the datebase. Everything was fine and it was working, then when I moved the project to the production servers - database server and web server. Following that all the users are failing to connct to database, getting this message "login failed for user 'username' I am getting the user with property identity and it...
14
425
by: Viviana Vc | last post by:
How can I programatically do the equivalent of the following: cacls "C:\Program Files\test" /T /G Everyone:f ? Thanks, Viv
0
8367
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
8889
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...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8570
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
8650
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...
1
6206
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
4202
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...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.