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

Multiple arguments IsNull function MS Access VBA
how to pass parameters to ExportWithFormatting using vbscript
Access 2010 cascading combo boxes runtime error 424
Access Month Calendar View
Shapefile to MDB with custom field structure [duplicate]
Query JET 4 database with SSIS
Microsoft Access 2010: Query Criteria moving
Is there a way to create an Access database from a Visio database model?
Access: insert multiselect box values into database
ms access extra table indexes
Recordsource vs Recordset for Unbound Forms
Access Database Remote Connection
How to programmatically convert Access 1997 .mdb to Access 2007 .accdb
Microsoft Access Duplicate Output Destination workaround
Ms access : calculated field from other table
Finding where an object in access is referenced

Categories

HOME
winforms
testng
openmp
keras
oracle11g
azure-data-factory
gremlin
comparison
grep
alfresco
cvs
spring-jdbc
virtualization
slurm
dax
rascal
php-7.1
remote-access
fortumo
ibm-odm
flask-wtforms
ups
carthage
percona
vaadin7
uitypeeditor
openedx
mps
centos6.5
fgetcsv
nhapi
greendao
maxmind
fabric8
preg-match-all
winrt-xaml-toolkit
usbserial
geopositioning
rotational-matrices
objectlistview
elasticsearch-plugin
bootstrapper
dism
particles.js
node-gyp
eigenvalue
.net-4.6.2
executenonquery
avconv
prolog-setof
jlink
forever
knockout-components
directory-structure
sqlclient
qtwebview
abcpdf9
ableton-live
nxt
removechild
sts-springsourcetoolsuite
dstu2-fhir
underscore.js-templating
ctest
mongocsharpdriver
player
simplewebrtc
skype4py
essence
master-slave
netmq
qtableview
ionic
service-accounts
arcanist
appfabric-cache
web-controls
skos
geonetwork
xc16
tablelayout
file-copying
client-side-templating
websocket4net
message-driven-bean
monomac
c18
gridfs
coverflow
gwt-rpc
sharp-repository
pygit2
lcs
jelly
anonymous-methods
jquery-knob
isnullorempty
mt
buildr
ohm
netdna-api
fireworks
php-parser
doh
mongomapper
zend-translate
microsoft-virtualization
dbisam
django-notification





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