By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,098 Members | 989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,098 IT Pros & Developers. It's quick & easy.

Fw: Compare textbox value to record in table

P: n/a
All,
Excuse the re-post but I have found something which works for the UserID
but not for the Password (see previous post below). The problem is I don't
understand how it works and therefore cannot update it to do as I need.
Could someone explain A) how to modify this to make sure the username &
password are valid or B) How the below works so I can do it myself. I have
never seen "PARAMETERS" used before in SQL which has thrown me completely.

The function I'm using for the UserID is:

Option Compare Database

Function ValidUserIDDAO(strUserID As String) As Boolean
Dim loDB As DAO.Database
Dim loQdf As DAO.QueryDef
Dim loRst As DAO.Recordset

Set loDB = CurrentDb
Set loQdf = loDB.QueryDefs("qry_validate_userid")
With loQdf
.Parameters(0) = strUserID
Set loRst = .OpenRecordset
End With

With loRst
ValidUserIDDAO = Not (.EOF And .BOF)
.Close
End With
Set loRst = Nothing
Set loQdf = Nothing
Set loDB = Nothing
End Function
The SQL I use is:

PARAMETERS TestUserID Text ( 255 );
SELECT tbl_user_id.UserID
FROM tbl_user_id
WHERE (((tbl_user_id.UserID)=[TestUserID]))
WITH OWNERACCESS OPTION;

I then call the function in the after update event of the UserID textbox:

If Not ValidUserIDDAO(Me.txt_user_id.Value) Then..........

TIA

Mark

----- Original Message -----
From: "Mark" <ma**********@ntlworld.com>
Newsgroups: comp.databases.ms-access
Sent: Monday, January 31, 2005 7:00 AM
Subject: Compare textbox value to record in table

Hi All,

Win XP, Office XP
What I am trying to do is create a login form. The problem is that I am
going to set the database up using Access security so that only admin
users
can read the tables. I plan to have all info coming from stored queries
with
"With OwnerAccess". With this in mind, what I am trying to do is: In the
afterupdate event of the username and password fields, look for the
existence (either true or false) of the username for the userid textbox
and
the username & password for the password textbox.

My understanding of VB is very limited but from what I can make out, I
need
to reference the result stored query/s.
Could anyone point me in the right direction please.

My table layout (Tbl_Users) is as follows:
Userid text PRIMARY KEY
Name text
Pwd text
Disabled yes/no
Security_level number
Ixxluda date/time

TIA

Mark

Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.