Go Back   Access World Forums > Microsoft Access Reference > Sample Databases

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 05-18-2010, 01:10 AM   #1
DCrake
Remembered
 
DCrake's Avatar
 
Join Date: Jun 2005
Location: Burnley, Lancashire
Posts: 8,634
Thanks: 8
Thanked 325 Times in 208 Posts
DCrake is a glorious beacon of light DCrake is a glorious beacon of light DCrake is a glorious beacon of light DCrake is a glorious beacon of light DCrake is a glorious beacon of light DCrake is a glorious beacon of light
Send a message via Skype™ to DCrake
Password Login Screen with session login recording

This demo has been expanded from my earlier version to include the creation of a login session. Whereby once a user logs in a new session is created and is subsequently closed when the user logs out.

As this is not split you will only ever see yourself as being logged in but the logic is there to be used.

Only Deliliah and Samson have passwords set they are Del and Samson respectively.

Note a simple encrypter/decrypter is used to store the passwords in a table.

If you feel so inclined any feed back regarding this and any other samples and help given can be done via my website feedback page. It's a bit lean at the moment. Need to build it up a bit.
Attached Files
File Type: mdb PasswordLogin.mdb (372.0 KB, 13526 views)

__________________
David Crake


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
The Home of Simple Software Solutions.

O/S Windows XP (SP3) & Windows 7 64bit
Access 2003 (version 11.0)
Access 2007 (version 12.0)

Remember when posting sample databases you will get a better response if it is pre Access 2007 - not all people have it installed.
DCrake is offline  
The Following 22 Users Say Thank You to DCrake For This Useful Post:
30702700 (03-18-2012), Arshad_M_Chohan (06-03-2011), asiedueric (12-01-2012), binbin (09-06-2012), checkit81 (10-13-2014), conandeaniv (03-08-2012), cooh23 (07-20-2011), Dre1tt (03-19-2013), eizik_g (11-09-2018), expat1000 (04-06-2012), GraemeG (03-24-2011), hassanogaibi (06-28-2016), jadehawk (03-06-2013), joxhibit (08-23-2012), luizvin (03-03-2011), mmadani (04-14-2011), Muaz (01-27-2014), niranjanprajapati23 (10-26-2018), nostupidquestions (08-04-2011), PamelaG (05-25-2011), Pusher (09-11-2011), s_m_chamberlain (05-06-2016)
Old 11-09-2018, 08:11 AM   #2
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,011
Thanks: 114
Thanked 3,014 Times in 2,741 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Password Login Screen with session login recording

Following a request by MarcusGR in this thread https://www.access-programmers.co.uk...d.php?t=302223, I have updated this utility to ACCDB format & made various changes so it will now work in both 32-bit & 64-bit Access

In doing so, I have
a) Replaced the code used to get user name / computer name with a different version using WScript. As a result, the API declarations are no longer needed
b) Added Option Explicit to each code module and declared any variables as necessary
c) made cosmetic changes to the appearance of the forms

The password encoding is done using a XOR function and is very weak/easily decoded.
I have left that as it is but would suggest stronger encryption e.g. using RC4 if passwords are to be stored in a database

NOTE: I didn't check the code for the password expiry. If it doesn't work, please PM me as, like all threads started by David Crake, the thread is now closed.

UPDATE:
The attached file has a serious error in that new users cannot be added.
Use the updated version attached to post #4 instead
Attached Files
File Type: zip PasswordLogin.zip (58.8 KB, 521 views)
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld

Last edited by isladogs; 11-14-2018 at 03:57 AM. Reason: Fixed incorrect link in line 1
isladogs is offline  
The Following 4 Users Say Thank You to isladogs For This Useful Post:
eizik_g (11-09-2018), Gasman (11-09-2018), MickJav (11-09-2018), sigma788 (11-10-2018)
Old 11-10-2018, 05:56 AM   #3
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,011
Thanks: 114
Thanked 3,014 Times in 2,741 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Password Login Screen with session login recording

As previously stated, whilst I would prefer not to have user passwords stored within a database, if it has to be done the passwords need to be encrypted properly rather than just encoded

I've now done an updated version of this with stronger password encryption based on the RC4 function (previously XOR encoding)

I've also added passwords to all except the last record which is the default 'not set'.
Compare the old XOR & new RC4 versions of each password
XOR could be decoded without much difficulty whether or not the 'cipher' is known
RC4 almost impossible to crack in everyday use unless you know the cipher.



Of course, 'del' isn't a strong enough password for any method of encryption though I expect that was David's point originally.

I would insist on passwords of a minimum length such as 8 characters including at least one of each of these: capital letter, small letter & number

Of course, a skilled hacker could still eventually crack the passwords ...which is why its better not to store these in the same database

The new code is in modEncryption and I've used 'isladogs' as the RC4 cipher.

NOTE: In a production database, I would store the cipher itself in a table, encrypted using a different system!

UPDATE:
The attached file has a serious error in that new users cannot be added.
Use the updated version attached to post #4 instead
Attached Images
File Type: png Pwd_XOR vs RC4.PNG (12.9 KB, 2878 views)
Attached Files
File Type: zip PasswordLogin_v2_CR.zip (71.2 KB, 389 views)

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld

Last edited by isladogs; 11-12-2018 at 02:42 PM.
isladogs is offline  
The Following 2 Users Say Thank You to isladogs For This Useful Post:
sigma788 (11-10-2018), Tera (02-12-2019)
Old 11-12-2018, 01:57 PM   #4
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,011
Thanks: 114
Thanked 3,014 Times in 2,741 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Password Login Screen with session login recording

OOPS!
There was a serious error in my two previous versions in that new users could not be added to the system
Many thanks for user MarcusGR for spotting this

Whilst fixing this I took the opportunity to check the rest of the original code and found that various parts didn’t work properly.
For example, the code to force users to update passwords after a set expiry date wasn’t working.

As a result, this ended up as a major rewrite. Many changes made including:

1. Tables tblUsers & tblPermissions have been merged

2. Added form to enter new user info including various optional settings:
a. User access level (1/2/3) with default = 1 (standard user)
b. Password expiry (days) with default=0 (never expire)
c. Change own password (yes/no) with default=No

3. All forms changed to border style = None

4. Form frmLogin changed to Shortcut menu = Yes to allow right click menu during development purposes
This should be reset to No for production use

5. Login button now remains disabled until the password has been validated

6. All various logic permutations completely rewritten removing all recordset code and checked
Amongst other things, the code now checks for:
a. Password expiry date (if any)
b. Users logged in on another computer – blocked for logging in again
c. Users still logged on current computer – previous session ended so new login possible
d. New password cannot match previous password

As supplied, there are 6 users:



To facilitate logic checking:
Billy is not active so won’t appear in drop down list
Jill has no password set so you will be prompted to enter a password
Tommy has a password which expired on 5 Oct 2018 so you will be prompted to enter a new password
The others can login normally (Delilah / Jack / Samson)

This version uses RC4 to encrypt the passwords..
I have not updated the XOR version but that code remains (disabled) if anyone wants to revert to using a weak form of password encoding.

I hope this updated version is useful to others.
It has no API calls so should work in both 32-bit & 64-bit Access
Developed in A2010 but should work in any version from A2007 onwards

I would be grateful for feedback on this. As this old thread is now officially closed, please contact me via PM if you find any issues or just to let me know its working as intended
Many thanks
Attached Images
File Type: png Users_v3.PNG (15.5 KB, 2844 views)
Attached Files
File Type: zip PasswordLoginRC4_v3.zip (107.7 KB, 466 views)
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld

Last edited by isladogs; 11-14-2018 at 03:11 AM.
isladogs is offline  
The Following 6 Users Say Thank You to isladogs For This Useful Post:
Gasman (11-12-2018), MarcusGR (11-14-2018), Minty (11-14-2018), mrcunknown (02-27-2019), Ravi Kumar (08-30-2019), Tera (02-12-2019)
Old 11-14-2018, 02:54 AM   #5
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,011
Thanks: 114
Thanked 3,014 Times in 2,741 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Password Login Screen with session login recording

Following a comment by MarcusGR in another thread, please note that users need to click Enter after entering their password.

The password is checked and, if it matches, the Login button is then enabled. This is because the code used to check the password runs in the after update event rather than the on change event.

If you think users won't realise this, do one of the following:
a) Change the scrolling text caption to:
Quote:
..........Please enter your user name and password below then press ENTER
Use spaces at the start (instead of ....).
The spaces are important to separate each scrolling iteration

b) Just replace the scrolling text with static text with no leading spaces
To disable the scrolling, set the timer interval to 0.
To remove it completely also remove the Form_Timer event code

HTH
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld

Last edited by isladogs; 11-14-2018 at 03:12 AM.
isladogs is offline  
Old 01-23-2019, 07:41 PM   #6
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,011
Thanks: 114
Thanked 3,014 Times in 2,741 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Password Login Screen with session login recording

Many thanks to Diogo Cuba for reminding me via PM of a bug in this application.
The first time you log in an invalid use of null error occurred in DoLogin event of frmLogin

Code:
'Create a login event for this user
         lngUserID = DMax("LoginID", "tblLoginSessions") + 1
The error was because I had emptied the table and adding 1 to null is still null!
The fix is very simple:

Code:
 'Create a login event for this user
         'v5 21/11/2018 - added Nz to manage case where no record exists
         lngUserID = Nz(DMax("LoginID", "tblLoginSessions") + 1, 1)
I had noticed the issue back in November last year but forgot to upload the fix at that time

Modified version attached - there may be other changes but as it was done 2 months ago I can't remember!
Attached Files
File Type: zip PasswordLogin_RC4_v5.1.zip (63.5 KB, 481 views)
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld

Last edited by isladogs; 01-24-2019 at 09:51 AM. Reason: Replaced attached file
isladogs is offline  
The Following 2 Users Say Thank You to isladogs For This Useful Post:
DiogoCuba (01-24-2019), Tera (02-12-2019)
Old 01-24-2019, 02:25 AM   #7
DiogoCuba
On Error GoTo AWF *****:
 
DiogoCuba's Avatar
 
Join Date: Dec 2018
Location: Rio de Janeiro - Brazil
Posts: 133
Thanks: 79
Thanked 3 Times in 1 Post
DiogoCuba is on a distinguished road
Re: Password Login Screen with session login recording

Quote:
Originally Posted by isladogs View Post
Many thanks to Diogo Cuba for reminding me via PM of a bug in this application.
Glad I could help, Colin!

__________________
Best regards,
Diogo Cuba

"Stay Hungry, Stay Foolish: you only live once, so make it count and go after what you want no matter what."
DiogoCuba is offline  
Old 07-20-2019, 03:53 PM   #8
Stoic
Newly Registered User
 
Join Date: May 2013
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
Stoic is on a distinguished road
Re: Password Login Screen with session login recording

@isladogs thanks for this platform. I really like it and would like to use it in my database, but I would like for users to enter their user ID and not select from a combo box. Therefore I would like to change the combo box to a text box, but changing it produces an error that points to Column 2.

I appreciate your help on this, kindly. I must admit, I am not an advanced access database developer.


Thanks,
Stoic is offline  
Old 07-21-2019, 12:16 PM   #9
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,011
Thanks: 114
Thanked 3,014 Times in 2,741 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Password Login Screen with session login recording

Hi Stoic
This is a moderated area and I've only just seen/approved your post.
The user name combo has 7 columns, all of which are referenced in the code.
To replace it with a textbox would require a significant rewrite of the code.
Whilst I have no objection to anyone doing so, I don't have the time to spare for this at the moment.

One possible approach to minimise the coding needed would be to keep the combo but hide it.
Add an unbound text box txtUser then add an after update event to set the hidden combo value to that

Code:
Private Sub txtUser_AfterUpdate()
Me.cboUser=me.txtUser
CboUser_AfterUpdate

End Sub
If the user enters an incorrect username, that should be covered by the cboUser NotInList event which already exists

Note this is untested code so may need tweaking. Good luck
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld

Last edited by isladogs; 07-21-2019 at 10:30 PM.
isladogs is offline  
Old 07-21-2019, 02:44 PM   #10
Stoic
Newly Registered User
 
Join Date: May 2013
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
Stoic is on a distinguished road
Re: Password Login Screen with session login recording

Quote:
Originally Posted by isladogs View Post
Hi Stoic
This is a moderated area and I've only just seen/approved your post.
The user name combo has 7 columns, all of which are referenced in the code.
To replace it with a textbox would require a significant rewrite of the code.
Whilst I have no objection to anyone doing so, I don't have the time to spare for this at the moment.

One possible approach to minimise the coding needed would be to keep the combo but hide it.
Add an unbound text box txtUser then add an after update event to set the hidden combo value to that

Code:
Private Sub txtUser_AfterUpdate()
Me.cboUser=me.txtUser
CboUser_AfterUpdate

End Sub
If the user enters an incorrect username, that should be covered by the cboUser NotInKist event which already exists

Note this is untested code so may need tweaking. Good luck
Thank you so very much. It worked just as I wanted. You are the best.
Thanks again.
Stoic is offline  
Old 07-21-2019, 10:29 PM   #11
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,011
Thanks: 114
Thanked 3,014 Times in 2,741 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Password Login Screen with session login recording

Excellent. Glad I could help.
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld
isladogs is offline  
The Following User Says Thank You to isladogs For This Useful Post:
Stoic (08-03-2019)
Old 07-25-2019, 08:39 AM   #12
xyba
Newly Registered User
 
Join Date: Jan 2016
Posts: 185
Thanks: 65
Thanked 0 Times in 0 Posts
xyba is on a distinguished road
Re: Password Login Screen with session login recording

Quote:
Originally Posted by isladogs View Post
Excellent. Glad I could help.

Hi
I've tried to incorporate you forms and tables into one of my db's (great work btw) but, when I open the login form and select my name from the combo I get the following error.

Error13 in cboUser_AfterUpdate procedure: type mismatch

I haven't changed any formats in either frmLogin or tblUsers so I'm confused. Would you know why I get this error?
xyba is offline  
Old 07-26-2019, 01:04 PM   #13
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,011
Thanks: 114
Thanked 3,014 Times in 2,741 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Password Login Screen with session login recording

Hi xyba.
You posted to a moderated area and I've only just seen your posts . I've deleted the duplicate post. Please see sticky thread about reporting your own posts to moderated areas.

Anyway, a type mismatch occurs when you try to link a number datatype to a text field or other similar situations.

In the example attached, the PK field is text but many user tables have a number or autonumber field for UserID. Have a look at the code and your data and hopefully the error will be obvious.

If not, to save issues with moderated posts, I suggest you post a new thread with a link to this one. Try to give additional details and someone (possibly me) will be able to assist. Good luck
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld
isladogs is offline  
Old 08-03-2019, 07:01 PM   #14
Stoic
Newly Registered User
 
Join Date: May 2013
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
Stoic is on a distinguished road
Re: Password Login Screen with session login recording

Quote:
Originally Posted by isladogs View Post
Excellent. Glad I could help.
Thanks again for your help. I would like to direct users to specific forms based on access level. I have the following code:

Code:
If DLookup("[AccessLevel]", "tblUsers", "[UserName] = " & Forms!frmLogin!cboUser) = 2 Then
    MsgBox "You have access to Human Resources Section!", vbOKOnly
    DoCmd.OpenForm "frmAdminCorner"
    End If

this is how I have it inserted within your code:


Code:
Private Sub DoLogin()

On Error GoTo Err_Handler

        'Create a login event for this user
         'v5 21/11/2018 - added Nz to manage case where no record exists
         lngUserID = Nz(DMax("LoginID", "tblLoginSessions") + 1, 1)
         
        'flag that the user is currently logged in
        Call CreateSession(lngUserID)
        Call LogMeIn(lngUserID)
        'Open the main form and close this one

If DLookup("[AccessLevel]", "tblUsers", "[UserName] = " & Forms!frmLogin!cboUser) = 2 Then
    MsgBox "You have access to Human Resources Section!", vbOKOnly
    DoCmd.OpenForm "frmAdminCorner"
    End If

        DoCmd.Close acForm, "frmLogin"
        
Exit_Handler:
    Exit Sub
    
Err_Handler:
    MsgBox "Error " & Err.Number & " in DoLogin procedure: " & Err.Description
    Resume Exit_Handler
    
End Sub
It is not working. I must be missing out on something.

Please help
Stoic is offline  
Old 08-04-2019, 12:04 AM   #15
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,011
Thanks: 114
Thanked 3,014 Times in 2,741 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Password Login Screen with session login recording

Stoic
A reminder that this is a moderated area which is why your three duplicate posts didn't appear.
I've deleted the duplicates.
Please see sticky thread above about reporting your own posts.

I'm answering on my tablet with no access to the original app. Will respond when I can view it.

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld

Last edited by isladogs; 08-04-2019 at 12:39 AM.
isladogs is offline  
Closed Thread

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] User Security Levels and Password login screen goldie12 Forms 5 10-21-2010 04:59 AM
Simple but efficient Password login screen DCrake Sample Databases 0 03-31-2010 03:54 AM
create a password protected form with VB JackBauer Forms 16 08-23-2009 08:43 AM
Inserting UserId into table after login screen syntax Modules & VBA 12 07-31-2008 03:28 PM
Help With Login Screen Code! 07' JBurlison Modules & VBA 7 03-14-2008 03:00 PM




All times are GMT -8. The time now is 01:18 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World