Solved

MS Access 97 query - Checkboxes to new field

Posted on 2009-05-15
4
375 Views
Last Modified: 2013-11-28
Hello gurus,

We have an Access Database which we are trying to port over to an Act Database.  Within the Access database are a number of checkboxes for example Type of Customer.  What I would like to do is have a new field called CustomerType which has the name of the Customer Type if it has a checkbox.  

To illustrate - let's say you have Tinker, Tailor, Soldier, Spy and one of those is ticked.  If Tinker is selected then update that record with the new field ID and have that say Tinker.

I guess it can be done with a case statement but I am not sure the syntax

In Psudocode something like

if Tinker = Yes then CustomerType=Tinker
If Tailor = Yes then CustomerType=Tailor
..
..
Else if Blank then CustomerType = Blank

Thanks in advance for any help / tips /websites to check out

Bilbo-UK
0
Comment
Question by:bilbo-uk
  • 2
  • 2
4 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 24397046
How about using IIF?

IIF(Tinker=true,"Tinker", IIF(Tailor=true,"Tailor", "") ) AS CustomerType

Syntax is

IIF(condition,value if true,value if false)

Now within each value, you can embed another IIF as you can see from my example above.

From the example, it reads

if tinker = true then
    customer type = tinker
else
    if tailor = true then
        customer type = tailor
    else
        customer type = blank
    end if
end if
0
 

Author Comment

by:bilbo-uk
ID: 24397183
Hi there rockiroads,

Would require sql commands within the VBA would it not?  Any ideas what those would be?

I'm a little confused as you put IIF at the top but in your example are using IF so basically a nested if construct - should it be if or iif?

0
 
LVL 65

Expert Comment

by:rockiroads
ID: 24397317
I dont know how you are doing your export. Are you using SQL or straight VBA?
Given sql, you can select all the fields you want, then run it, exporting results into a csv file. I am not familiar with act database but there may be a import process that allows csv imports.

Correct syntax is IIF in SQL
In VBA it is IF
0
 

Accepted Solution

by:
bilbo-uk earned 0 total points
ID: 24848675
We ended up doing it a long winded way but done now

Thanks

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…

929 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

12 Experts available now in Live!

Get 1:1 Help Now