Password form

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
 
A

Alex Dybenko

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
 
D

Douglas J Steele

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
 
G

Guest

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
 
A

Alex Dybenko

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
 
G

Guest

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
 
A

Alex Dybenko

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
 
P

Peter R. Fletcher

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top