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 library for performing many kinds of DDL operations on a database (to facilitate application version upgrades)?
How to Remove Stop Words from a string using Visual Basic?
Microsoft Access runtime error 2455 when trying to access grandchildren forms from child form
Microsoft Access - stored procedure with cursor
MS Access - Write to Table Immediately After Changing Value in Form
Unbind Access Project from source control
DAO access recordset not updating
No values given for one or more required parameters error only on some Windows 7 machines
In Memory, Stand-Alone, Disconnected ADO Recordset
Record-Locking in Access 10
How to force access to begin a new record
How should I setup Shipping and Receiving tables for RDBMS?
Remove link for linked table in access
MSACCESS 2002 Linked Table Performance Really Slow
ms access 2010 update linked table with no primary key
Memo field value truncated to about 1000 characters when inserted from a .net typed dataset

Categories

HOME
ionic-framework
debugging
heroku
push-notification
cplex
youtube-dl
rsyslog
yahoo-oauth
elm
alpha
adobe-analytics
kentor-authservices
modx-revolution
zend-framework3
commonmark
designer
caml
swingx
physics-engine
tokenize
bootstrap-duallistbox
fifo
elasticsearch-net
file-rename
bluestacks
bcd
twilio-api
fog
jmonkeyengine
android-ble
libvpx
dynamics-crm-2013
hue
galen
core-plot
nand2tetris
android-mediaprojection
no-www
sencha-touch-2.3
outlook-2013
qsslsocket
celery-task
sybase-asa
memory-alignment
cudafy.net
titanium-android
pycaffe
deadbolt-2
file-writing
mikroc
measures
lua-5.1
dlna
fadeout
ptrace
uid
muse
interrupted-exception
sniffer
unity3d-gui
typekit
google-style-guide
cdt
has-many-through
starcluster
expected-exception
android-2.2-froyo
oracle-warehouse-builder
typo3-neos
pyhdf
page-layout
soundtouch
ora-00911
eclipse-memory-analyzer
qt-faststart
spring-validator
sabredav
specification-pattern
itmstransporter
browser-detection
frameset
multipage
chrono
cufon
oncheckedchanged
datareader
lang
ext3
adrotator

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