Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 30th, 2008, 12:39 PM
Authorized User
 
Join Date: Dec 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Incl certain fields if they appear multiple times

Not sure which forum to post this in. I have an issue I need to resolve, and have developed an extremely messy and time consuming way of implementing it. I am looking to streamline the process to enable faster and more frequent updates, and was hoping someone might be able to help me.

I have a long list of "areas" (ie Area 1, Area 2, 3, 4, etc all the way to 9000). Each area has a certain number of languages assigned to it, anywhere from 1 - 7. Each area can be listed a random number of times, ie Area 1 can be listed 20 times (so the total list has over 30,000 records). Each time an area is listed, it can have different languages attached to it. Example:

(each semi-colon indicates a new column)

Area 1 ; English ; French ; Italian ; German ; Farsi
Area 1 ; English
Area 1 ; French ; Hindi
Area 1 ; French ; Italian ; Tagalog
Area 2 ; English
Area 2 ; American Sign Language
Area 3 ; French

What I am trying to do, is have a final list of all areas listed just ONCE, and any languages that appear 2 or more times for each area. Example, if English appears twice or more for Area 1, it would be listed, but if Italian only appears once, it won't be:

Area 1 ; English ; French
Area 2 ; Hindi ;
Area 3 ; French

I can use excel/access/vba anything. I am eager to hear your ideas! Let me know if you need more clarification as this was hard to explain.

Thank you!!
 
Old November 4th, 2008, 12:52 PM
pjm pjm is offline
Authorized User
 
Join Date: Jul 2006
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would start out by using SQL to create a table with just 2 columns: Area & Language

    SELECT DISTINCT Area, Language1 as Language into <newtable> FROM <oldtable>

    and then for <x> = 2..7:

    INSERT INTO <newtable> (Area, Language)
    SELECT DISTINCT Area, Language<x> as Language FROM <oldtable>

From here you can create yet another table with the area and 7 columns for languages and
build a record for each area by going thru the sorted list (by area) of records in <newtable>.

      -Phil-





Similar Threads
Thread Thread Starter Forum Replies Last Post
same records shown multiple times alie VB Databases Basics 1 March 8th, 2006 10:13 AM
Problem with loading user control multiple times neha mukerjee ASP.NET 2.0 Basics 0 February 24th, 2006 06:11 AM
Button Handler Being called multiple times ExDb VB Databases Basics 1 January 22nd, 2006 07:32 PM
print multiple times..multiple rows... abhit_kumar JSP Basics 3 January 18th, 2005 07:11 PM
Updating multiple Rows from multiple fields in ASP vdm_nana SQL Server ASP 0 April 1st, 2004 04:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.