I'm confused. I thought GUserName = rst.Fields("UserName").Value did the job. If it's not, how do I change it (or add) so it does?refer back to post #2 - one bit of your code does not assign a value to GUserName per gemma's second point
Oh darn.so look at post #5 - where are you assigning a value to GUserName if rst.eof is true? i.e. a user is not found. The main form still opens
Have you tried logging in where a username or password is incorrect? what happens?
strSQL = "SELECT UserName, Password FROM tbl_login WHERE UserName = """ & Me.txt_username.Value & """ AND Password = """ & Me.txt_password.Value & """"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)
If rst.EOF Then
'MsgBox prompt:="Incorrect username/password. Try again.", buttons:=vbCritical, Title:="Login Error" --- commented out 10/13/2020
MsgBox prompt:="Incorrect username/password. Try again.", buttons:=vbCritical, Title:="Login Error" & "strSQL = " & strSQL 'added 10/13/2020
Me.txt_username.SetFocus
Exit Sub 'Added 1/13/2021 TESTING
Else
definitelyShould I put that and include Option Explicit?
teach you to read replies more carefully. That's a week of your life you won't get backOh darn.
definitely
teach you to read replies more carefully. That's a week of your life you won't get back
not necessarily. Doesn't mean you have handled all errors such as your gUserName problem. It does mean you can now create a .accde if you wanted which stops users from messing with forms and code.nothing came up, which is suspicious.
No GUsername problems so far.not necessarily. Doesn't mean you have handled all errors such as your gUserName problem. It does mean you can now create a .accde if you wanted which stops users from messing with forms and code.
.accde if you wanted which stops users from messing with forms and code
Yes, the tables are stored on a password protected BE stored on a shared server. A max of 4 users (including myself) downloads a fresh copy of the FE onto their hard drive, by means of a batch file, every time they open the db.if the tables are in a back end and the backend is password protected, users cannot change a table design (although someone who knows what they are doing can easily find the password), All they can do is delete the linked table in the front end. Any app that you are supporting (i.e. there is at least one other user) should be split as a matter of course as it makes it much easier to undertake maintenance.
As far as I know, no one other than me creates queries.@gemma-the-husky
users can still change tables and queries, but not other objects. It can be useful for them to be able to change queries at times, to be honest
As far as I know, no one other than me creates queries.
Ah gotcha.its not that. If a user wants a one off "special", or finds a minor issue, it's possible to solve it sometimes by getting them to change an existing query under supervision, or adding a new query using the SQL statement, which avoids the delay in creating, testing and releasing a new version just for that change.