ms-access


Access 2007 Male, Female, Unisex Categories for either Gender


I'm fairly new to Access 2007. I'm an ERP functional consultant with programming experience close to none.
I'm setting up an Access database for personal use. Let's say I have product categories as Male, Female, Unisex. I have product colors as black and white. When entering an order, I select a color (combo box) i.e black and then gender (combo box) i.e male. In the order form gender can be either male or female but not unisex.
In prodcut id field (combo box) I need to see black items with male and unisex gender.
When I set up the query in product id combo, the OR operator precedes the AND operator, then I see white items too. As a result I see all the male and unisex items.
I couldn't find a way put an OR operator within an AND operator so to speak.
I changed my approach and instead of placing Male, Female, Unisex in one field, I created two checkbox fields, Male and Female. This time I tried to query Products.Male=True if GenderCombo=Male, Products.Female=True if GenderCombo=Female along with color but no luck.
Which approach do you recommend and what should be the query like.
Thanks in advance for your help.
Bekir.
Check your query script, and note that AND has a higher precedence than OR. You will have to use brackets to get exactly what you want.
example:
where productcolor = 'Black' and gender = 'Unisex' or gender = 'Male'
this will give you all Black Unisex together with all Male of any color.
What you want is probably:
where productcolor = 'Black' and (gender = 'Unisex' or gender = 'Male')
You could also write that as:
where productcolor = 'Black' and gender in ('Unisex', 'Male')

Related Links

Change MS Access to Exclusive on the fly
Update Procedure “N/A” to Empty String on MS Access
MS Access: How can I find out where Tables, Queries, Macros etc. are used?
INSERT INTO statement, new record: how to grab autoid number created?
In VBA, cannot use Access.Application object
Using VBA to Update a form recordset in Access 2007
How to be productive in Access VBA + SQL development?
creating queries during runtime in msaccess
MS-Access: Selecting rows to delete via joins
How to set up a development environment in MS Access
Access - Data Provider Not Initialised?
How to use SubSonic with MS Access database
NetBeans IDE 6.5 and Microsoft Access
What is the VBA syntax to access hidden tables in MS-Access?
How do you redimension an array in VBA?
Exporting to text using access query with parameters

Categories

HOME
twitter
coq
webpack
debugging
omnet++
electron
mean-stack
android-4.4-kitkat
routes
kalman-filter
graphql
cakephp-2.5
disassembler
fingerprint
convolution
user-input
collectd
uitypeeditor
openrefine
http-status-code-504
normalizr
plunker
immutable.js
kryo
jquery-ajaxq
orleans
captiveportal
trading
crosstab
h2db
cas
spark-jobserver
dynamic-featured-image
fluentvalidation
neo4j-spatial
assistant
wtx
atlassian-crucible
windows-server-2000
exuberant-ctags
titanium-mobile
copying
catch-all
http-referer
cloud-code
sharefile
document.write
squib
particles.js
nand2tetris
password-encryption
arena-simulation
heightmap
slick-3.0
sas-jmp
angular2-meteor
rainbowtable
parentheses
celery-task
datastax-startup
mplayer
nstextview
kbuild
nodebb
qtwebview
pearson
arrow-keys
blacklist
crosswalk-runtime
smart-table
yt-project
cubes
heidisql
vmware-tools
ado.net-entity-data-model
mongocsharpdriver
sigabrt
php-parse-error
ios4
intellij-14
spidermonkey
muse
android-listview
responsive-images
ideamart
skos
device-orientation
titanium-modules
document-classification
onactivityresult
openexr
article
funcunit
comexception
rtmfp
android-2.2-froyo
html5-notifications
farseer
xsockets.net
cdc
gridcontrol
mylyn
android-screen-support
comaddin
selected
mhtml
runas
frameset
propertyeditor
datawindow
pysimplesoap
osql
pendrive
hgsubversion
django-tagging
locationlistener
jmock
forums
ncqrs
substrings
exchange-server-2003
backcolor
gacutil
putchar
post-build
ugc
django-notification
windows-live-messenger

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