From: kay on
ok thanks, I have access2003
Lets first work on Login form:
here is the code i am trying.
When you leave blank in username and password it pops up message ( I have
put that message as I know that cursor goes to On Error GoTo
Err_cmdLogin_Click)

with this code problem is that when you enter any value which in not in the
EmpID table, it opens the form. it means it is not validating user input.
txtUserNm - is unbound text box
txtPassword - is unbound text box
cmdLogin - is command button
----------------
Private Sub cmdLogin_Click()
On Error GoTo Err_cmdLogin_Click

Dim rs As DAO.Recordset
Dim strUser As String
Dim strPassword As String

txtUserNm.SetFocus
strUser = txtUserNm
txtPassword.SetFocus
strPassword = txtPassword



If Not IsNull(Me.txtUserNm) And Not IsNull(Me.txtPassword) Then
Set rs = CurrentDb.OpenRecordset("Select
tblEmpID.EmpID,tblEmpID.EmpPassword from tblEmpID where EmpID = '" & strUser
& "' And EmpPassword = '" & strPassword & "'", dbOpenSnapshot)

If rs.EOF Then
DoCmd.OpenForm "frmResourceV2"
Else
MsgBox "In Correct"
End If
End If
Exit_cmdLogin_Click:
Exit Sub

Err_cmdLogin_Click:
MsgBox "Enter the UserName & Password"
'MsgBox Err.Description
Resume Exit_cmdLogin_Click


End Sub


"Jeff Boyce" wrote:

> Let me re-phrase ...
>
> Please post the code you are trying.
>
> Regards
>
> Jeff Boyce
> Microsoft Access MVP
>
> --
> Disclaimer: This author may have received products and services mentioned
> in this post. Mention and/or description of a product or service herein
> does not constitute endorsement thereof.
>
> Any code or pseudocode included in this post is offered "as is", with no
> guarantee as to suitability.
>
> You can thank the FTC of the USA for making this disclaimer
> possible/necessary.
>
> "kay" <kay(a)discussions.microsoft.com> wrote in message
> news:831C9FD4-76DA-487C-BB34-E02A76A99CBE(a)microsoft.com...
> >I am creating a application to keep a track of resources
> > As I have explained in my previous post,
> > My main form - frmResources - which I will put as default form when user
> > opens the application.
> > This form will be used by to group of people - One group will use this
> > form
> > to enter the data and other group will use same form to edit the data.
> >
> > I am working on this form. In this form I have not make - DataEntry set
> > to
> > "Yes" as this form will use to update the data as well.
> > Second form I am working on to create Login for users.
> >
> > I have created table call tblEmpID which has fields such as
> > EmpID,EmpName,EmpPassword,EmpEmail,EmpDept.
> >
> > In the Login form I have created two textboxes and 1 Login Button.
> > I have put code on click for login button . but its not working properly.
> > This code is not validating user info. What ever I enter it opens the main
> > form.
> > I have posted the code in my previous post. So I don't know what's wrong
> > with that code.
> >
> > I am working on to create other forms as well, but first I want to get
> > done
> > these two forms.
> >
> > So please guide me. I don't mind starting from scratch.
> > Thanks!
> >
> >
> >
> > "Jeff Boyce" wrote:
> >
> >> Please post what you are trying so we can offer our ideas on why it
> >> may/may
> >> not work.
> >>
> >> Regards
> >>
> >> Jeff Boyce
> >> Microsoft Access MVP
> >>
> >> --
> >> Disclaimer: This author may have received products and services mentioned
> >> in this post. Mention and/or description of a product or service herein
> >> does not constitute endorsement thereof.
> >>
> >> Any code or pseudocode included in this post is offered "as is", with no
> >> guarantee as to suitability.
> >>
> >> You can thank the FTC of the USA for making this disclaimer
> >> possible/necessary.
> >>
> >>
> >> "kay" <kay(a)discussions.microsoft.com> wrote in message
> >> news:8A4CC309-58F6-4B5E-A0C6-489FEA05A390(a)microsoft.com...
> >> > Thanks jeff for your suggestions.
> >> >
> >> > currently I am working on Login form where I want user to enter
> >> > username &
> >> > Password.
> >> > I am trying so many codes but not working.
> >> > I have tblEmpID - fields are : EmpName,EmpID,EmpPassword
> >> > I have tried two ways - 1. created a query to get EmpID and EmpPassword
> >> > from
> >> > EmpID table whrer EmpID - criteria is forms!frmLogin!txtEmpID
> >> > 2. ubbound taxboxes
> >> >
> >> > but both ways are not working - I think i am doing some silly mistake
> >> > in
> >> > writing code.
> >> >
> >> > in my previous post i post the code which I tried earlier.
> >> > Please help to write the login code so when user click on the button,
> >> > it
> >> > should valideate the valuse with the table and then open the main form.
> >> >
> >> > Thanks
> >> >
> >> >
> >> >
> >>
> >>
> >> .
> >>
>
>
> .
>