473,324 Members | 2,541 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,324 software developers and data experts.

Check If User Exist In Table Using DLookup

I am trying to use the DLookup function to check a table to see if a user exist in there; if not refuse them access. The following is the code I am using but it seems to just pop up the "Error Message" without really referencing the table

text33 = Environ("username")
Text69 = DLookup("[Forename]&' '&[Surname]", "Users", "[Username] = text33")
If text33 <> DLookup("[Username]", "Users", "[Username] <> text33") Then
MsgBox "You Are Not Authorized To Use This Form"
Else
If Val(Me.estp) > DLookup("amountauthorized", "Users", "UserName = '" & Me.text33 & "'") Then
MsgBox "Amount Over approval limit, Please Assign to Your Manager"
Else
With MailOutLook

Any help will be appreciated
Feb 1 '10 #1
1 2897
yarbrough40
320 100+
I think what you want here is DCount (as opposed to DLookup)

something like this:
Expand|Select|Wrap|Line Numbers
  1. dim i as integer
  2. dim Authorized as Boolean
  3. i = DCount("[Forename]&' '&[Surname]", "Users", "[Username] = text33")
  4.  
  5. if i > 0 then
  6. Authorized = true
  7. else
  8. Authorized = false
  9. end if
  10.  
  11.  
Feb 1 '10 #2

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

Similar topics

3
by: Josh Armstrong | last post by:
I need a form to check for duplicates before a new record is added. Table name: Links Field1: LinkSysNum Field2: SysNum For example, =539 is linked to =540 =544 The db is setup using a...
8
by: Jude | last post by:
Hi all, I'm trying to mix bold and non-bold text within a textbox on a report. Has anyone out there ever figured out how? Thanks! Jude
2
by: John M | last post by:
Hi, I want to create a link to another database table. I've succeeded in doing this, and avoided creating the the link over and over again by putting in the error statement something to the...
2
by: Mike N. | last post by:
Hello again.. I have a table with a text field named "Requisition" (Indexed, no dupes). It is not the key field. This field is the first text box on a form. I would like to check to make sure the...
5
by: micklee74 | last post by:
hi in my code, i use dict(a) to make to "a" into a dictionary , "a" comes from user input, so my program does not know in the first place. Then say , it becomes a = { '-A' : 'value1' , '-B' :...
5
by: starke1120 | last post by:
Im creating a check in – check out database for RF guns. I have a table that contains models. ID (primary key) Model A table that contains Gun Details ID (primary key) Model_id...
1
by: ApexData | last post by:
No point in reinventing the wheel! -I'm looking to create a popup dialog that prompts for FirstName MI Lastname. -Checks and reports duplicates. -And offers the user an option to continue or...
9
reginaldmerritt
by: reginaldmerritt | last post by:
I have a table which uses two primary keys. One is a canidate code the other is a course\programme code. I have a fom with these two fields but automaticaly picks the candidates code. Therefore...
14
by: Dan | last post by:
Hello, we have an intranet application using Windows Integrated Authentification. When an user starts the application, he gets a form for inputting data. The first time he does that, the...
1
by: Constantine AI | last post by:
Hi i am trying to get User input if data does not exist within a DLOOKUP table. I have gotten it to work for one record but not multiple, i have tried to incorporate my code into a loop procedure but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.