Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lookup adds field?

Status
Not open for further replies.

BT24

Programmer
Joined
Aug 19, 2002
Messages
76
Location
CA
Hello
I have a login table and when the person adds there login and password it adds a field to the table. How can i change this so it looks up a field and not makes a new one? the code that i am using is this
If DLookup("[Password]", "tblUsers", _
"[Username]='" & Me![txtUserName] & "'") = Me![txtPassword] Then
DoCmd.Close
DoCmd.OpenForm "Switchboard"
Else
If MsgBox("The Password that you entered was invalid", vbRetryCancel) = vbRetry Then
DoCmd.OpenForm ("frmLogin")
Else
DoCmd.Quit
End If
End If
End Sub

thanks for the help
IAMUSELESS
 
Why are you creating your own security option when Access will do this for you using Access security?

As a side comment, you are automatically opening your switchboard if your user clicks retry which I do not think you want to do. Also, the code you have will not add a new record, so I am not really sure what you are asking for.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Useless - I saw your other post on creating this login and hadn't replied yet. I completely agree with thornmastr. You should really read up on Access Security.

Not out to give you a lecture, but just some reasons why not to create your own security. You may have already thought of this, but just to make sure - you realize that if a user logs in to your system (using your security) then they can open the table with all the passwords in it. Also, if you are using a startup script to ask for this password, a skilled user will be able to figure out a way around it.

Setting up Access security can be a little tough the first time - especially reading the help files. But there are a lot of people on this forum with tons of experience who can answer your questions.

One last note - if txtUserName and txtPassword are bound fields (bound to the password table), depending on how you implemented them, then yes, they will add a new record to the table.

Let us know what questions you have on Security or if you have any follow up questions on this one.

Jay
 
Thanks for the help Guys, the reason that i wanted to use the other method is so that i could know who was using the database on the network. so if they login then i would no who from what area are the ones entering the information the most.

Thanks Again, without you people at this site i would be at a phycoligist
IAMUSELESS
 

I went back and read your post, and the associated comments a bit more carefully.

Really, it seems that what you want to do is record statistical information on your users. First, let me give you a strong push….a polite kick perhaps…in the direction of Access Security simply because it will give you the current user (his login name). For what you want to do, that is ideal.

Consider, when your application first starts; grabbing the user name and the current date and time. Plop that in your table. That will give you the user and when he logs in. then, on ending the application, you can again record the user name and the current date and time. Now you know how long he has used the system. You can also record every time the user does a write operation. You can record all kinds of statistics.

Just something for you to mull over.

And finally one more thing; a request. Change your name. If the people who are responding to you thought you might really be useless, there would be no replies. You are about to drive me to a psychologist and I rank them only slightly above lawyers.

Good luck on your project.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top