Password form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table that holds all user ID's and passwords

my logon form is 2 text boxs [username] and [password]

i want the form to check and validate the username against the table that a
user inputs then check for the password and also validate.

this name i then want access to hold in a variable for the time that the
program is running

an help or pointers to sample code would be greatly appreciated
 
Hi,
something like this:

strUser=me.username & ""
if me.password=dfirst("Password","UserTable","UserName=" & """" & strUser &
"""") then
'logged!
else
msgbox "Wrong user name or password"
end if
 
If you want the password to be case-sensitive, use:

If StrComp(Me.password, Nz(DLookup("Password","UserTable","UserName=" & """"
& strUser & """"), ""), 0) = 0 Then

(the Nz(DLookup("Password","UserTable","UserName=" & """" & strUser & """"),
"") is a good idea even if you don't want case sensitivity: if the user
doesn't exist in the UserTable, the lookup will return Null, and you'll get
an error when you try to compare Null to a value)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Alex Dybenko said:
Hi,
something like this:

strUser=me.username & ""
if me.password=dfirst("Password","UserTable","UserName=" & """" & strUser &
"""") then
'logged!
else
msgbox "Wrong user name or password"
end if

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com


in message news:[email protected]...
I have a table that holds all user ID's and passwords

my logon form is 2 text boxs [username] and [password]

i want the form to check and validate the username against the table that
a
user inputs then check for the password and also validate.

this name i then want access to hold in a variable for the time that the
program is running

an help or pointers to sample code would be greatly appreciated
 
thanx fo the answer, but i have a question, i cannot see where the variable
created in that stament for holding the user name...

sorry to be a pain.... can anyone help?

thanx again
--
many thanx


Alex Dybenko said:
Hi,
something like this:

strUser=me.username & ""
if me.password=dfirst("Password","UserTable","UserName=" & """" & strUser &
"""") then
'logged!
else
msgbox "Wrong user name or password"
end if

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com


the_duracell_rabbitt said:
I have a table that holds all user ID's and passwords

my logon form is 2 text boxs [username] and [password]

i want the form to check and validate the username against the table that
a
user inputs then check for the password and also validate.

this name i then want access to hold in a variable for the time that the
program is running

an help or pointers to sample code would be greatly appreciated
 
just use dim to declare it:

Dim strUser as string

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com



the_duracell_rabbitt said:
thanx fo the answer, but i have a question, i cannot see where the
variable
created in that stament for holding the user name...

sorry to be a pain.... can anyone help?

thanx again
--
many thanx


Alex Dybenko said:
Hi,
something like this:

strUser=me.username & ""
if me.password=dfirst("Password","UserTable","UserName=" & """" & strUser
&
"""") then
'logged!
else
msgbox "Wrong user name or password"
end if

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com


"the_duracell_rabbitt" <[email protected]>
wrote
in message news:[email protected]...
I have a table that holds all user ID's and passwords

my logon form is 2 text boxs [username] and [password]

i want the form to check and validate the username against the table
that
a
user inputs then check for the password and also validate.

this name i then want access to hold in a variable for the time that
the
program is running

an help or pointers to sample code would be greatly appreciated
 
thanks to those that posted allready

i am aware of "declaring" but how can i get a text box to show that variable
later in the program...

and just a small confirmation if you would "string" can be letters and
numbers or just letters?


--
many thanx


Alex Dybenko said:
just use dim to declare it:

Dim strUser as string

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com



the_duracell_rabbitt said:
thanx fo the answer, but i have a question, i cannot see where the
variable
created in that stament for holding the user name...

sorry to be a pain.... can anyone help?

thanx again
--
many thanx


Alex Dybenko said:
Hi,
something like this:

strUser=me.username & ""
if me.password=dfirst("Password","UserTable","UserName=" & """" & strUser
&
"""") then
'logged!
else
msgbox "Wrong user name or password"
end if

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com


"the_duracell_rabbitt" <[email protected]>
wrote
in message I have a table that holds all user ID's and passwords

my logon form is 2 text boxs [username] and [password]

i want the form to check and validate the username against the table
that
a
user inputs then check for the password and also validate.

this name i then want access to hold in a variable for the time that
the
program is running

an help or pointers to sample code would be greatly appreciated
 
you can assign variable value to textbox:
me.textbox1= strUser

string - can contain and letters, and numbers, and special characters

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com



the_duracell_rabbitt said:
thanks to those that posted allready

i am aware of "declaring" but how can i get a text box to show that
variable
later in the program...

and just a small confirmation if you would "string" can be letters and
numbers or just letters?


--
many thanx


Alex Dybenko said:
just use dim to declare it:

Dim strUser as string

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com



"the_duracell_rabbitt" <[email protected]>
wrote
in message news:[email protected]...
thanx fo the answer, but i have a question, i cannot see where the
variable
created in that stament for holding the user name...

sorry to be a pain.... can anyone help?

thanx again
--
many thanx


:

Hi,
something like this:

strUser=me.username & ""
if me.password=dfirst("Password","UserTable","UserName=" & """" &
strUser
&
"""") then
'logged!
else
msgbox "Wrong user name or password"
end if

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com


"the_duracell_rabbitt" <[email protected]>
wrote
in message I have a table that holds all user ID's and passwords

my logon form is 2 text boxs [username] and [password]

i want the form to check and validate the username against the table
that
a
user inputs then check for the password and also validate.

this name i then want access to hold in a variable for the time that
the
program is running

an help or pointers to sample code would be greatly appreciated
 
Or, particularly if you want to use it in multiple places in Forms,
Queries, and/or Reports, you can create a Function to return the value
of the variable, e.g.

Function ReturnUser () As String

ReturnUser = strUser

End Function

You can then call the Function (in the normal way) anywhere you want
the value of the variable, presuming that it is either Global, or
statis within the Module where the Function is defined.

you can assign variable value to textbox:
me.textbox1= strUser

string - can contain and letters, and numbers, and special characters

Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Back
Top