ms-access


How to segregate a single value from a query in MS Access


My apologies but I am a bit lost in the world of Microsoft Access. So I currently have a query that returns a column of values. The output looks like this:
SMABranchCode
Code1
Code2
Code3
etc.
This query then gets moved to a form text box. To do this, I have used Control Source like so:
=IIf(IsNull(DLookUp("SMABranchCode","PWS_SM_QUERY"))," ","X")
This works "Ok"; however there are going to be probably 30+ more text boxes going horizontally next to this one all running the same query. Above them is a label with the Code. So basically when it spits out the data it looks like this (as long as there is an entry for that code):
Code 1 | Code 2 | Code 3
X | X | X
The problem is, I either need to go and create a query for each of these text boxes so that it only pulls a single entry for each Code OR I can hopefully change up my Control Source entry (=IIf(IsNull(DLookUp("SMABranchCode","PWS_SM_QUERY"))," ","X")) to include criteria so that each text box has its own Criteria, so that from the one original query, each Code (1,2,3) only displays its information.
I have tried changing DLookUp to have criteria which has looked like this:
=IIf(IsNull(DLookUp("SMABranchCode","PWS_SM_QUERY","SMABranchCode = Code1"))," ","X")
However that gives me an #Error! in the boxes I apply it too. I'm hoping maybe someone can help me figure out a solution since my brain is turning to mush over this.
Thank you
I presume SMABranchCode is a text type field. Criteria values for text fields must be delimited with apostrophes, date/time field values would use #.
"SMABranchCode = 'Code1'"

Related Links

Count unique values in Access
If ComboBox on Form is blank, Then
Trying to do a calculation with data from a date and the data from the day before
MS Access Front-end: Does each user need their own copy?
trying to filter subform based on contents of field on main form
How to use MS access on a server where MS Office is not installed
How do i import and eliminate first two row of website in msaccess while importing html pages
Multi criteria dlookup issue
Count all checkboxes in ms-access form…what am I doing wrong?
How do I set a default selection to a Listbox in MS Access
Microsoft Access not overwriting when exporting a query to excel
Using ms-access command-line tag /x but database opens read-only
Criteria with TempVars - but prompt user if tempvars is null
Crazy Cursor in TextBox on Table from ODBC database
Count of dates “This Month” to appear in a text box in Access Report
Issue with Removing References in Microsoft Access

Categories

HOME
sendgrid
google-api-php-client
view
webstorm
analysis
binary-tree
ip
umd
callback
installshield
ebean
opengl-es-2.0
handsontable
messages
visual-studio-cordova
try-catch
caml
workload-scheduler
worldwind
telephony
serilog
physics-engine
abi
mmap
spark-jobserver
fgetcsv
spring-mybatis
fabric8
http-status-code-503
column-family
wixsharp
plsql-psp
restlet
hot-module-replacement
hockeyapp
webix-treetable
reportbuilder
impersonation
cookiecutter-django
dism
powershell-dsc
businessworks
btrace
scorm
angular-resource
filepicker
apache-fop
blogengine.net
forever
google-perftools
nbconvert
color-profile
color-picker
removechild
infix-notation
sts-springsourcetoolsuite
mongocsharpdriver
nsviewcontroller
lua-5.1
make-install
suffix-tree
rhino-servicebus
spim
cannon.js
qdialog
citrus-pay
responsive-images
angular-local-storage
key-management
facebook-graph-api-v2.4
xcode-6.2
device-manager
document-classification
onactivityresult
xojo
yorick
app42
cloud-connect
mysqltuner
tws
dmoz
cascalog
parametric-equations
removeclass
nsobject
data-loss
genshi
calling-convention
iphone-web-app
fluent-interface
asp.net-mvc-areas
dmx512
infrastructure
icanhaz.js
firefox-5
genealogy
django-notification
3gp

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