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

Access - DLookup in a table field?
Can't get the Today() function to work properly in MS Access 2016 Custom Web App
Access VBA code in Form_current updating previous record, not current
Access VBA with Outlook - “.To” Line displays Primary Key instead of Email information
Syntax for # literal in ms-access hyperlink?
Alert of duplicate name in Access 2003, despite a duplicate I want to decide if include it or not
Cannot Add/Edit Hyperlink MS Access
Create a recordset using node-adodb in protractor
Enable controls based if a record exists
MS Access: unbound text box for dcount with date parameters
Unable to refresh a local table created from linked table
Form set to be used for data entry attempting to create duplicate records causing error
Use of DCount in Access to produce group sequential column
Acccess VBA-Division by Zero
How to split a table in a report MS Access
asp.net core 1. how change the Target Runtime to x86

Categories

HOME
cakephp
vim
osgi
testng
listview
hook
server
relative-path
appx
sd-card
at-command
spring-cloud-stream
elm
dxl
retrofit
convolution
directx
reveal.js
mapserver
google-cloud-ml
circular-dependency
gz
leiningen
messages
openrefine
saxon
reactive-cocoa
custom-wordpress-pages
xlsxwriter
format-specifiers
cas
compatibility
large-file-upload
media-queries
react-chartjs
withings
twitch
tasker
optix
texmaker
isbn
parentheses
logparser
hendrix
kbuild
pillow
migradoc
visual-c++-2008
deadbolt-2
android-fonts
spring-android
grails-tomcat-plugin
bonobo
dstu2-fhir
phishing
simplewebrtc
whois
dataview
tform
jfugue
iad
xna-4.0
t4mvc
cakephp-3.1
cisco-ios
iiviewdeckcontroller
umbraco6
titanium-modules
aapt
wp-query
expected-exception
comexception
ftps
free-variable
angularjs-controller
uiviewanimation-curve
mercurial-server
window-management
gnustep
genshi
servicehost
winbugs14
xfbml
html-input
dentrix
getresponsestream
firefox4
mtj
thread-local-storage
geneva-server

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App