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 / Modules / DAO / VBA / May 2005

Tip: Looking for answers? Try searching our database.

Dlookup Qustion

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Neil - 04 May 2005 10:46 GMT
I have database that is public access but needs some features accessed only
by certain people.

I have created a table (called tblApprovalTable) which has the following
fields, as well as others.

Pin
PassName
SecurityLevel

I have created a form that is displayed when the protected options are
selected asking the user to enter their Passname and Pin which i then want to
check against the Approval Table.
On the 'OK' button I have the following code.

Person = Me.Text2   'Put the entered Passname into a variable
Code = Me.Text4     'Put the entered PIN code into a variable
Pincode = DLookup("[Pin]", "[TblApprovalTable]", "[PassName]" = Person)

The problem is that the variable called Pincode is being returned empty, so
the rest of the routine doesn't work.
I've not had any experience of using variables in Dlookup statements before,
so I suspect that there's something wrong with the last bit where I've used
the 'Person' variable.
I can't find any help searching anywhere else, so if anyones got any clues
then you might just save my sanity.

Thanks in advance

Neil
Nikos Yannacopoulos - 04 May 2005 12:10 GMT
Neil,

The problem is the syntax of the Where clause; change the line of code to:

Pincode = DLookup("[Pin]", "[TblApprovalTable]", "[PassName] = '" _
    & Person & "'")

(you can remove the undersore and keep it all in one line, I didn't
because it would most likely wrap in your newsreader).

HTH,
Nikos

> I have database that is public access but needs some features accessed only
> by certain people.
[quoted text clipped - 26 lines]
>
> Neil
Neil - 04 May 2005 12:45 GMT
Thanks Nikos, it worked perfectly.
I knew it was something to do with the variable name, just couldn't work out
the syntax around it but it's all clear to me now!!

Neil

> Neil,
>
[quoted text clipped - 39 lines]
> >
> > Neil
Nikos Yannacopoulos - 04 May 2005 13:43 GMT
Welcome!

> Thanks Nikos, it worked perfectly.
> I knew it was something to do with the variable name, just couldn't work out
[quoted text clipped - 45 lines]
>>>
>>>Neil
 
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.