473,903 Members | 3,244 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 2734
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
3347
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
2754
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
9999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11282
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
10983
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,...
1
8048
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
7206
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5894
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
6088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3324
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.