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