ms-access


[Msoft Access]Error with running code for DLookup


I have a problem with Microsoft access for code I have written to lookup the USER TYPE field in the ADMINSTRATOR TABLE.It is not able to run due to syntax error 3075 missing expression operator in query expression 'USER TYPE'
It is used for my login menu to differentiate between two different user types and bring them to different forms.
The code works before I implemented the User Security code
Dim UserLevel As Integer
UserLevel = DLookup("USER TYPE", "ADMINSTRATOR TABLE", "USER ID = '" & Me.txtLoginID & "'")
Here is my code:
Private Sub Command1_Click()
Dim UserLevel As Integer
If IsNull(Me.txtLoginID) Then
MsgBox "Please enter Login ID", vbInformation, "Login ID Required"
Me.txtLoginID.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "Please enter Password", vbInformation, "Password Required"
Me.txtPassword.SetFocus
Else
If (IsNull(DLookup("[User ID]", "ADMINSTRATOR TABLE", "[User ID]='" & Me.txtLoginID.Value & "' And Password = '" & Me.txtPassword.Value & "'"))) Then
MsgBox "Incorrect Password or Login ID", vbInformation, "Login unsuccessful"
Else
UserLevel = DLookup("USER TYPE", "ADMINSTRATOR TABLE", "USER ID = '" & Me.txtLoginID & "'")
DoCmd.Close
If UserLevel = 1 Then
MsgBox "Login Success", vbInformation, "Login Success"
DoCmd.OpenForm "MAIN MENU"
Else
MsgBox "Login Success", vbInformation, "Login Success"
DoCmd.OpenForm "ADMINISTRATOR FORM"
End If
End If
End If
End Sub
Field names and table names containing spaces or special characters (poor design choice) need to surrounded with square brackets.

Related Links

MS Access search for record by textbox instead of dropdown
Uniqueness Constraints in MS Access
Application Icon path in MS Access
Microsoft access is a mere file or data-base server
Is ACE/Jet's IN operator or CHECK constraint 'broken'?
Form.CurrentRecord=1 and Form.RecordSet.Absoluteposition=-1
email using Access and VBA without MAPI
MS Access Properties
Will Access support 35- 40 users writing to a Access database
Trying to limit input on a field
Sorting by month in MS Access
How to add a menu item to the default right click context menu
ASP Access Database web site on Windows 2008 Server running IIS 7
How to populate field descriptions in MS Access
Version control for VBA file
Mystery HAVING clause

Categories

HOME
ionic-framework
google-chrome-extension
clips
hive
openmp
syntax
setup-deployment
convolution
in-app-purchase
adfs
cloudkit
session-variables
fortumo
ups
decimal
openrefine
saxon
django-cms
karma-jasmine
google-pagespeed
scichart
nodatime
rundeck
spark-jobserver
django-storage
maxmind
ping
elasticsearch-net
windows-server-2000
quote
key-value-observing
http-status-code-503
.net-4.0
scorm2004
winrt-xaml-toolkit
android-ble
host
bitbucket-pipelines
scaffold
web-mining
swift3.0.2
unspecified
uft-api
angularjs-factory
sas-visual-analytics
email-templates
gulp-sourcemaps
dynamic-reports
outlook-api
galleria
taffy
python-webbrowser
csound
knockout-components
libusb-win32
epson
gcsfuse
spring-mongodb
vtigercrm
nested-sets
abcpdf9
azure-virtual-network
sigabrt
essence
livequery
ios4
kendonumerictextbox
xna-4.0
reactive-banana
prerequisites
sdhc
collapse
ruby-2.2
mutation-observers
iis-arr
has-many-through
dealloc
ms-project-server-2010
opcache
html4
dataadapter
eventlistener
factory-method
google-email-migration
first-responder
venn-diagram
objective-c-2.0
php-parser
gcj
invite
rfc1123
propagation
floating
sudzc
gamma
bespin
fixed-width
brewmp

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App