473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MS Access VBA making multiple tables from one base query

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 2768
ADezii
8,834 Expert 8TB
@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,556 Expert Mod 16PB
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
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,556 Expert Mod 16PB
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
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
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...
11
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...
5
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...
13
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...
6
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...
0
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...
4
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...
4
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...
1
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'...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.