Tempvars username not displaying on subsequent forms

donkey9972

Registered User.
Local time
Today, 08:34
Joined
May 18, 2008
Messages
46
Hi again,

I am having trouble with my change password form. What I want to happen is when a user logs in with their temporary password which once assigned will simply be Password then they are redirected to change their password upon that first login, which is working fine. The problem is once that form opens up and the login form has closed I want the username to be displayed in the user name field. Right now it is simply coming up as blank/empty. Additionally, any for that opens up after login, the admin form displays admin, and the user form also displays admin. I am perplexed where I went wrong. Please help.
 

Attachments

Last edited:
Show us you code.
Do not make us download a db for such a simple error.
Where are you setting the TempVar?

OK, downloaded the DB, give us the sequence of the forms being loaded. Do no make us guess. YOU know how it is meant to work, I for one do not. :(

Start learning to walk your code with F8 and breakpoints.
 
I get invalid use of Null on the ChangePassword form

1732099504912.png

The form loads with the username via this code
Code:
Private Sub Form_Load()
    Me.Tex110 = TempVars("username").Value
    txtPassword.InputMask = "Password"
    txtPassword2.InputMask = "Password"
End Sub
[code]

Edit: When that error is corrected and you go through the rest of the code, the password does NOT get updated, and so unable to login with those credentials. So that is something else you will need to fix.

As I am having written on my headstone 'Walk your code' :)
 
Last edited:
First thing you should do is add the below to every module
Code:
Option Compare Database
Option Explicit
Then fix your undeclared variables.

assuming it's the user doing it, it Seems a little redundant to me that when setting up a new account you need to enter "Password" twice only to then have to immediately change it. Why not set the password during the create account routine?
If it's an admin then set the default value of the password to "Password"

I would probably also bind the Account update form.

I might also run a check on the user name. What happens when Bill Smith and Bob Smith both use BSmith as a user name?
 
Last edited:
First thing you should do is add the below to every module
Code:
Option Compare Database<br>Option Explicit
You need to add that manually for existing objects.
Then go into VBE editor and Tools/Options and ensure Require Variable Declaration is ticked.
That will then add the Option Explicit at least from then on.

Why it is not by default, I will never know. :(
1732106104468.png
 
You need to add that manually for existing objects.
Then go into VBE editor and Tools/Options and ensure Require Variable Declaration is ticked.
That will then add the Option Explicit at least from then on.

Why it is not by default, I will never know. :(
The best explanation I have heard is that it would cause chaos among the millions of database created by inexperienced newcomers who would have no clue as to why their code failed.
 
But, if it was simply ticked by default in new databases, it wouldn't cause a problem in existing ones?
And noobies would get an obvious error in their code?
 
But, if it was simply ticked by default in new databases, it wouldn't cause a problem in existing ones?
And noobies would get an obvious error in their code?
That's kind of the point. Noobies would get an obvious not-so-obvious errors in their code because they would have no clue why it occurred.

But really, that's just a surmise anyway. I'm sure there are other, equally plausible reasons.
 

Users who are viewing this thread

Back
Top Bottom