Solved

IIF Question in Access either in a table or a query

Posted on 2013-01-08
10
217 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
  • 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
 

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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

895 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now