473,659 Members | 2,965 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Access VBA making multiple tables from one base query

2 New Member
Given the following Access database items:

CityTable:
-------------------
ID City
1 Memphis
2 Los Angeles
3 Tucson
4 Sacramento
5 Austin

PeopleQuery:
-------------------
ID First Last City
1 Ted Strickland Memphis
2 Jen Landry Memphis
3 Jerry Presh Los Angeles
4 Roxanne Bider Los Angeles
5 Pam Archdale Tucson
6 Jen Luxe Sacramento

I need to create a VB function that can be called which cycles
through each of the of the records in CityTable and Creates a
Table for EACH city which is populated with only the related
City records of the PeopleQuery. Each table needs to be named
the City Name. I even need a blank table for Austin which
doesn't have any records in PeopleQuery. I do NOT want to setup
multiple copies of PeopleQuery with a different City criteria.
The function should call PeopleQuery and provide a City parameter
during processing. Can someone help?!

** Email address removed **
Jun 18 '10 #1
4 2784
ADezii
8,834 Recognized Expert Expert
@cpamerlin
Just to clarify. You wish to dynamically create a Table for each Unique City from (CityTable), then populate these Tables with only the Records pertaining to each specific City in (PeopleQuery). Is this correct? If this assumption is correct, then you would have a Table named Memphis with the following Records:
------------------------------------------------------------------------
The Memphis Table:
Expand|Select|Wrap|Line Numbers
  1. ID    First     Last             City
  2. 1     Ted       Strickland       Memphis
  3. 2     Jen       Landry           Memphis
  4.  
------------------------------------------------------------------------
Jun 19 '10 #2
NeoPa
32,568 Recognized Expert Moderator MVP
We can help with specific questions, but we will not provide ready-made solutions on request (any such responses would be removed anyway).

If you would like to discuss what you've already tried and your current understanding then we can help fill in the blanks of course.

I'm sure the first piece of advice any of us would give would be to warn against the approach you are indicating as it is not normalised (See Normalisation and Table structures).
Jun 19 '10 #3
cpamerlin
2 New Member
ADezii, your understanding of the question and related outcome example are both correct.

NeoPa, I realize the tables are not normalized, I am really trying to create and then later route these tables as reports to separate users/systems, and I only want to route data pertaining to them.

Another user sent me an example of a Do While Loop that I may be able to build my function around. Thanks for your help!
Jun 21 '10 #4
NeoPa
32,568 Recognized Expert Moderator MVP
That makes sense. Let us know if you struggle with any particular aspect.
Jun 21 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
9182
by: Sami | last post by:
Could someone explain clearly how to go about doing this? I have tried setting up the structure on numerous occasions, but it never seems to work. Could someone please help me out? Thanks!
1
10606
by: Brian | last post by:
I'm trying to find a way to search multiple tables for the same record. Say I have 3 tables all with a name column, I need to search all 3 tables and find matching names. Is there an easy way to accomplish this?
11
2716
by: Randy Harris | last post by:
I have been using "IN" to query tables in Oracle from MS Access very successfully. Select Field FROM MyTable IN [ODBC...etc Works great if there is only one table involved. Anyone know how I can use the same technique with multiple tables (and be certain that the join occurs at the server). --
5
3061
by: mimo | last post by:
Hello, I have seen samples on how to pull data from one table and save back to it using the Form View control. How do I pull from multiple tables and save back to multiple tables on one screen? Is there a sample of this somewhere? For example I want to create a Name and an Address from one screen. It has to create a Name Record, a Name Address Record, and a NameAddressJoin Record.
13
6774
by: ricky.agrawal | last post by:
I'm really not sure how to go about this in Access. What I've created is a table for each location. Those tables are identical in format but different in information. The tables are named after key points such as the store number and the store ID. The fields of those tables are generic fields such as sales per day, bank deposit and what not. The first field for each store table is the date and I've set that as the primary key as one...
6
10480
by: ApexData | last post by:
I have 2 tables: Table1 and Table2. Neither one has a primary key because each table will only have 1-record. My form is a SingleForm unbound with tabs (my desire here). Using this form, in the Record Source I originally had the statement TABLE1, and all worked fine. Now I want to open the second table as well, and this is where my problem is.
0
1544
by: HydroPnik | last post by:
Hi all! What a great community you have here. Being an Access newbie I have already used much information gleaned from the other posters for my current project. I have been tasked with creating a database that will link to a table ("tbl_Data File) located in another database ("Database1"). Changes will be made to a customer record queried from Database1 and saved in a table located in Database2 called "tbl_Instructions". So far I have...
4
2343
by: dstorms | last post by:
I'm trying to run an update query on multiple tables, and since Access doesn't allow me to update tables from a union query, I'm writing a module as a workaround. So I've set up a temporary recordest (rstName) from the union query (qryEqiupEmplOnly), and construced a Do-Loop that updates the corresponding table. Unfortunately the Update SQL code prompts a compile error "Expected End of statement" and highlights "rstName" (line 28) as the...
4
3292
by: knix | last post by:
I have this access project consisting of multiple tables that are linked together in a relationship. I would like to migrate the consolidated information through appending in a datasheet form or importing the gathered information . Can anyone please give solutions with my problem? Can I make a datasheet form (consisting fields from multiple tables that are linked together with relationships) in ms access which I could paste append or insert...
1
2371
by: bbcdancer | last post by:
I have a database table called "tbl_personal" and struggling to VBA program a bit of code to create multiple tables in a database from the main "tbl_personal" table. In this case the 'color' column is the field I would like to look at. 1. Identify the number of unique records in column 'color' 2. For each color record that is label as red in the "tbl_personal"
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.