SimonB
10-01-2008, 01:22 PM
I am trying for the first time to use the new VBA global variable feature in Access 2007, the TempVars collection. I have a form for the user to log into the DB, using a Username and Password. I have limited the allowed number of login attempts, and need to increment a counter for each attempt. Here's what I am doing:
I declare three TempVars on the Form_Open module this way:
TempVars("CurrentUserName").Value = "Username" ' Spaceholder name until set by user.
TempVars("LoginAttemptCounter").Value = Val("0") ' Initial value, to be incremented with attempt.
TempVars("MaxAllowedLoginAttempts").Value = Val("3")
The login screen has an OK button. The module associated with that button's OnClick event loops through a process of validating the entered login credentials, and it has an incremented counter for each time the button is clicked. It has this check in it:
If [TempVar]![LoginAttemptCounter] < [TempVar]![MaxAllowedLoginAttempts] Then...
The compiler doesn'y like this statement. I get the error message, "Microsoft Access can't find the field '|'referred to in your expression. My syntax is bad, somehow. Does anyone see the problem, and know how to fix it?
Thanks in advance, SimonB
I declare three TempVars on the Form_Open module this way:
TempVars("CurrentUserName").Value = "Username" ' Spaceholder name until set by user.
TempVars("LoginAttemptCounter").Value = Val("0") ' Initial value, to be incremented with attempt.
TempVars("MaxAllowedLoginAttempts").Value = Val("3")
The login screen has an OK button. The module associated with that button's OnClick event loops through a process of validating the entered login credentials, and it has an incremented counter for each time the button is clicked. It has this check in it:
If [TempVar]![LoginAttemptCounter] < [TempVar]![MaxAllowedLoginAttempts] Then...
The compiler doesn'y like this statement. I get the error message, "Microsoft Access can't find the field '|'referred to in your expression. My syntax is bad, somehow. Does anyone see the problem, and know how to fix it?
Thanks in advance, SimonB