473,395 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Log in form to validate access to my Microsoft DB

42
I wish to create a log in form to validate access to my Microsoft DB. I have created the TBL: Analyst with the following fields:
RACIF ID

I only want the user to enter their RACIF ID then press Enter to proceed. IF they exist in table then the main form will display if not then a system message will display.
Mar 22 '10 #1

✓ answered by patjones

If you can post the code that you tried so far then that would help me figure out where you're going wrong. DLookup has some pretty specific syntax. Thanks.

Pat

7 1587
patjones
931 Expert 512MB
Hi -

There are a few ways you could do this, but the simplest is probably to use the DLookup function to determine if the ID exists. If DLookup returns null, the ID doesn't exist in your table and you can display your error message. If DLookup returns not null, then you can open up your main form.

Pat
Mar 22 '10 #2
Bre035
42
I tried several versions of Dlookup without success.
Mar 22 '10 #3
patjones
931 Expert 512MB
If you can post the code that you tried so far then that would help me figure out where you're going wrong. DLookup has some pretty specific syntax. Thanks.

Pat
Mar 23 '10 #4
Bre035
42
Private Sub Command3_Click()


End Sub

Private Sub Detail_Click()

End Sub

Private Sub RACIF_ID_AfterUpdate()

RACIF_ID = DLookup(RACIF_ID, TBL: ANALYST, [RACIF_ID]= & RACIF_ID)

End Sub
Mar 23 '10 #5
patjones
931 Expert 512MB
Bre -

The arguments in DLookup are strings...

DLookup("RACIF_ID", "TBL: ANALYST", "[RACIF_ID] = " & Me.RACIF_ID.Value)

You want to have a conditional that does something like

Expand|Select|Wrap|Line Numbers
  1. If IsNull(DLookup("RACIF_ID", "TBL: ANALYST", "[RACIF_ID] = " & Me.RACIF_ID.Value)) Then
  2.      MsgBox "No such user ID. Try again.", vbExclamation+vbOKOnly, "Log In Error"
  3.      Exit Sub
  4. Else
  5.      'Close log-in form and open main form here
  6. End If

I'm assuming that RACIF_ID is a number; but if it's a text value, the criteria needs to be modified as "[RACIF_ID] = '" & Me.RACIF_ID & "'". You might also want to modify the name of the text box on your log-in form since it makes the criteria argument in DLookup a little confusing.

Pat
Mar 23 '10 #6
Bre035
42
Thank you. I got it to work.
Mar 23 '10 #7
Bre035
42
Here is the code I used but I had to tweek some other properties on my text boxes:
Option Compare Database

Private Sub Enter_Click()
On Error GoTo Err_Enter_Click


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_login2"
DoCmd.OpenForm stDocName, , , stLinkCriteria


Exit_Enter_Click:
Exit Sub

Err_Enter_Click:
MsgBox Err.Description
Resume Exit_Enter_Click




End Sub


Private Sub asdfEnter_Click()
On Error GoTo Err_asdfEnter_Click

DoCmd.Minimize

Dim stDocName As String
Dim stLinkCriteria As String

Me.txtLoginCount = DLookup("racf_id", "tbl_racfid", "racf_id=Login_RacfID")

If IsNull(Me.txtLoginCount.Value) Then
MsgBox ("Not a valid Racf_ID")
Else
stDocName = "frm_login2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

Exit_asdfEnter_Click:
Exit Sub

Err_asdfEnter_Click:
MsgBox Err.Description
Resume Exit_asdfEnter_Click

UCase (Me.Login_RacfID)

End Sub

Private Sub Form_Load()
'Me.txtLoginCount.Value = DLookup("LoginCount", "qry_getLogin_Count")
End Sub
Mar 23 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: CJM | last post by:
Can somebody clarify if/how/when a simple form is submitted when the <Enter> key is pressed? As I understood it, if you have a form with a single submit button, if enter is pressed, the form...
1
by: iMedia User | last post by:
I have a site where I want to use the Web form validators in two separate forms on a single page. One form allows existing users to log in while the second one allows new users to register. The...
3
by: Vi | last post by:
Hi, I have a form which displays some orders based on dates selected or based on an order number. I have two different buttons for each kind of query, but both buttons call the same method in the...
9
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be...
4
by: Matt | last post by:
I have the following in a page and I am trying to update a record on the next page but for some reason the form data is not carrying over. Any ideas why? <form name=nxtlupdate method=post...
2
ak1dnar
by: ak1dnar | last post by:
Hi, please help me on this. Here i am having a simple form that consist with name and email fields and both are required fields. i am going to validate this inputs using validate.php. but since i...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
4
by: Anthony P | last post by:
Hello Everyone, I am having some trouble getting my JavaScript to validate my form fields. I've included more information below. My explaination of the code is in ALL CAPS so it stands out from...
6
by: Tomino | last post by:
Hi, I am working on a log in form for an Access 2003 db. Because the built-in jet database engine doesn't supply the ability to record every log attempt, failed attempt, validate passwords, user...
8
by: chromis | last post by:
Hi, I'm writing a contacts section for a cms on a website, I've decided to write the section in OO code. So far I have my Contacts object and a page structure I would use for a procedural site. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.