Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / November 2005

Tip: Looking for answers? Try searching our database.

Table design?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jsc3489 - 04 Nov 2005 15:50 GMT
Warning: newbie
I've already posted this in the wrong area, sorry. Anywho...

I'm trying to design a table around a dlookup statement I have.
I'm having trouble putting it all together.

strName = Forms!login1.Login        'a selected name at login from dropdown
menu
strPassword = Me![Password]

If StrComp(Nz(DLookup("[Password]", "UserDef", "User_Name ='" & strName &
"'"), ""), strPassword, 0) = 0 Then

If I understand this, I need a field called Password in Table UserDef ...
after that I'm lost.
Where do I put my criteria?
How?
Please give absurdly detailed answer.

Signature

I reject your reality and substitute my own.

Promote hydrogen - one of the best "clean" fuels there are!

Steve Schapel - 04 Nov 2005 19:07 GMT
Jsc3489,

I think you probably want this...

 If DLookup("[Password]", "UserDef", "User_Name ='" & Me.Login & "'") =
Me.Password Then

So, your UserDef table has 2 fields, User_Name and Password.  And the
form from which this code is being called has an unbound combobox called
Login, for the selection of the user name, and an unbound textbox called
Password for the entry of the user's password.  And I would guess the
rest of the code might look something like this...

 If Me.Password = DLookup("[Password]", "UserDef", "User_Name ='" &
Me.Login & "'") Then
     DoCmd.OpenForm "YouCanDoSomethingNow"
 Else
     MsgBox "Invalid password"
     Me.Password = Null
 End If

At the risk of adding confusion, an alternative approach would be to
include both columns of the UserDef table in the Row Source of the Login
combobox.  In this case, the Properties of the combobox get set like this...
 Column Count: 2
 Bound Column: 1
 Column Widths: x;0
    (where x is the number that is wide enough to show the user names
in the drop-down list)
... and then you can dispense with the DLookup function, in favour of...

 If Me.Password = Me.Login.Column(1)

Signature

Steve Schapel, Microsoft Access MVP

> Warning: newbie
> I've already posted this in the wrong area, sorry. Anywho...
[quoted text clipped - 14 lines]
> How?
> Please give absurdly detailed answer.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.