469,343 Members | 5,596 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

Fw: Compare textbox value to record in table

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)
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]))

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

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



----- 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
can read the tables. I plan to have all info coming from stored queries
"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
the username & password for the password textbox.

My understanding of VB is very limited but from what I can make out, I
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



Nov 13 '05 #1
0 2115

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by dskillingstad | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.