Windows Logon

S

smortimore

Hello,


I have a form which I want to secure by asking the person to
authenticate using their Windows userid and password.


Any ideas how I can do this ??


I don't want to use Microsoft Access security...


Thanks in advance...


Steve
 
D

Douglas J Steele

Depending on your setup, you should be able to use something like what Randy
Birch has at http://vbnet.mvps.org/code/network/acceptsecuritycontext.htm

(Obligatory warning: Randy's site is aimed at VB programmers, not Access
programmers. Because there are significant differences between how forms
operate in VB and Access, some of his examples don't always port easily into
Access. Looking at this particular one, though, I don't think there should
be any problems,)
 
N

Nikos Yannacopoulos

This looked very interesting, so I thought I'd give it a shot. The code
needs some minor changes:

* Access VBA doesn't like working with the the .Text property of
controls (unless they have the focus), but it is not required anyway. I
just dropped the property reference altogether, working with just TextX
instead.
* The code in Text3_KeyPress attempts to trap the Enter keypress, to run
the code behind the command button's click event. Two problems here, (1)
Command1.Value = True doesn't work in Access VBA, had to use
Command1_Click (sub call) instead, and (2) it turns out the KeyPress
event doesn't fire at all when Enter is pressed (!) in A2K3. I finally
used the textbox's On Exit event instead.

Now, the real problem: the code returns False no matter what, except
when all three textboxes are Null!!!

If anybody bothers and gets lucky, I'd be interested to know.

Nikos
 
N

Nikos Yannacopoulos

Actually it does work with the modifications I made. It turns out I had
locked my account during the trials, which is why I was getting False
with the correct credentials.

It does have holes, though: not only the one mentioned in the article
(returns True without a domain - though not with a wrong domain!), it
also returns true with all three entries Null.

Nikos
 
D

Douglas J Steele

It should be trivial to add edits to ensure that a domain is provided and
that not all entries are Null.
 
N

Nikos Yannacopoulos

It is, and I would if I were to use it, but I don't have a need for it
right now. I was just experimenting.

Actually, if I were to use it, I would have to add some code anyway, to
the effect that the outcome is grant or deny access to the application.
 
Top