• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

IIF Question in Access either in a table or a query

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
gracie1972
Asked:
gracie1972
  • 4
  • 4
1 Solution
 
IrogSintaCommented:
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
 
mbizupCommented:
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
 
mbizupCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
gracie1972Author Commented:
Can you help with the rest of the code?  I am not that versed in VB

Private Sub BSA_AfterUpdate()

 

End Sub
0
 
gracie1972Author Commented:
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
 
mbizupCommented:
<<
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
 
gracie1972Author Commented:
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
 
mbizupCommented:
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
 
gracie1972Author Commented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now