By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,705 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,705 IT Pros & Developers. It's quick & easy.

Access expressions

P: 2
Hi everyone,
I am just starting with the Access and I was wondering, if someone could help me:

I created a few boxes in the database, but I dont know how to build expressions to get a default value for them:

1. One of those boxes is called "sex" and what I am trying to do, is to set up a default value for it, so it will fill out automatically with:
"F" when the "title" is "Miss" or "Mrs" or "Miss" and
"M" when the "title" is "Mr"

2. Another one would be "age group" with subcategories filled out automatically:
(I have already created a field "age" with a current age of the client, so that box "agegroup" would depend on this one.

3. Then "postcode" field, that would 'cut off' the second part of the original postcode (uk postcodes i.e. eh13 4ed), so that I can have them grouped in a report.

I hope that I haven't complicated it too much!!

Sep 5 '08 #1
Share this Question
Share on Google+
2 Replies

P: 2
I found and answer for the first one....
Could anyone please help me with the secon one??

=IIf([Age]= Between "16" And "19", "16-19" Or [Age]= Between "20" And "25", "20-25" Or [Age]= Between "26" And "35", "26-35" Or [Age]= Between "36" And "45", "36-45" , "45+")

??? i think its too many value there.........?>>>>
Sep 5 '08 #2

Expert Mod 15k+
P: 31,754
You don't paint a very clear picture I'm afraid of what you're trying to do.

Assuming you are looking at coding a query from a table where [Age] is a field :
Expand|Select|Wrap|Line Numbers
  1. SELECT [Age],
  2.        Switch([Age]<20,'16-19',[Age]<26,'20-25',[Age]<36,'26-35',[Age]<46,'36-45',TRUE,'46+'),
  3.        ...
  5. FROM [YourTable]
Sep 6 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.