Solved

IIF Question in Access either in a table or a query

Posted on 2013-01-08
10
222 Views
Last Modified: 2013-01-18
I have a table that stores information based on a check box in the form.  This data is stored as a -1.

For example field name [BSA].  If yes it will store -1.
I actually want the data to be stored as BSA.  Then I can link this to another table for a different function.

Is this possible?
0
Comment
Question by:gracie1972
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
10 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 38756981
Assuming your form is bound to your table where this BSA field is, make your checkbox unbound and on it's AfterUpdate event, add:
[BSA]="BSA"
Dirty = False

Open in new window

0
 
LVL 61

Expert Comment

by:mbizup
ID: 38756986
Do you have values other than BSA that you want to store in that field?

If so, you can use an Option Group whose stored values are set to BSA, ABC, XYZ, etc.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38756999
But if it is a single boolean value you can always keep it as a Yes/No field and query it as text when needed:


SELECT iif(YourField = TRUE, "BSA", "")  AS Organization
FROM YourTable
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:gracie1972
ID: 38757002
Can you help with the rest of the code?  I am not that versed in VB

Private Sub BSA_AfterUpdate()

 

End Sub
0
 

Author Comment

by:gracie1972
ID: 38757010
THere are 8 separate choices so I had to do separate check boxes.  
When I tried a multi-select it was not storing the data separately.  The end goal is to capture resources by skill set.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38757033
<<
THere are 8 separate choices so I had to do separate check boxes.  
>>

If those choices are related and are mutually exclusive  (such as "Organization type"), it is generally better design practice to use a single field to hold those value.

Option groups are designed for mutually exclusive data, with checkboxes or radio buttons for each option.  The default values stored are integers, but I believe you can have them store text as well.
0
 

Author Comment

by:gracie1972
ID: 38775701
I've requested that this question be deleted for the following reason:

I created a different solution than what was listed in this question.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38775702
I object to the deletion -

Ideally post your solution if you used a different method.

Also, we did offer valid solutions (even if they were different from your method) to the question as originally posted, and would have helped implement any if you had followed up.
0
 

Author Comment

by:gracie1972
ID: 38775723
I ended up creating separate check boxes that were bound to its own field linked by Resource ID.  It became to complicated to do this any other way with the solutions provided above.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question