Solved

MS Access 97 query - Checkboxes to new field

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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…
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…

803 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