Solved

MS Access 97 query - Checkboxes to new field

Posted on 2009-05-15
4
374 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

707 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