Create several tables from two tables

L

LisaInAz

I have tried to research what I am trying to do and can't seem to find a
solution, I am not sure if it can be accomplished. I am not very good at the
coding portion in regards to Access/VB. I am self taught.

Basically I have two tables TABLEA Contains unique values TABLEB Contains
the data, both have same FieldAUNIQUEVALUE. No relationships have been set.
From these two tables I want to make as many tables as there is unique value
as there are tables programatically...
EXAMPLE
TABLE A TABLE B
FieldAUNIQUEVALUE
FieldAUNIQUEVALUE,FieldBIDNBR,FieldCDistrictOffice

SAMPLE DATA
TABLEA TABLEB
F1BT F1BT,123456,F1A
F1BU F1BT,234568,F1A
F2BW F1BT,098765,F1A
F2BU F1BU,098765,F1A
F1BU,456783,F1B
F1BU,456567,F1C
F2BW,098765,F2A
F2BW,111111,F2B
F2BU,111111,F2B
F2BU,234567,F2B
F2BU,345890,F2B
Goal 4 different tables, each named with TABLEAFieldAUNIQUEVALUE containing
corrected data
NEW TABLE
F1BT would contain 3 records
F1BU would contain 3 records
F2BW would contain 2records
F2BU would contain 3 records

I know I could accomplish this manually but I would have to do it 36+ times
with separate queries. Any suggestion is greatly appreciated, even if it is
to accomplish manually. Thank you in advance.
 
B

Beetle

STOP!

What you are attempting to do would be very poor design
and would result in a maintenance nightmare. Plus, you
would (most likely) reach the maximum table limit in a
very short time.

If you can tell us *why* you think you need to do this, then
someone can give you advice as to how to proceed. It's
lilely that you just need to relate the two tables and use a
simple query to view only the records you want to see.
 
L

LisaInAz

I was able to resolve this issue thanks to everyones help now I have another
issue

Again I tried to research and I am not sure if I should start a new thread
or continue with this one...

I now would like to pass the number of records that I need for each unique
entity via form/table, below is the SQL that is working however, I have 36
different entities where I need to randomly select X data . <using SQL server
is not an option; we are using Access 2002 SP3>...

SELECT TOP 1883 Rnd([CountNum]) AS RandomValue, tbl002_F1BWDATA.CountNum,
tbl002_F1BWDATA.Unique, tbl002_F1BWDATA.UniqueTwo, tbl002_F1BWDATA.DISTRICT,
tbl002_F1BWDATA.ELIG, tbl002_F1BWDATA.PRIM_ID INTO tbl003C_F1BWDATA
FROM tbl002_F1BWDATA
WHERE (((randomizer())=0))
ORDER BY Rnd([CountNum]) DESC;

I have found a few items

Such as

Dim intRecCount As Integer
intRecCount = DCount("*", "tblTest")

&
****************
Private Function TopParameter()

Dim dbf As Database, qdf As QueryDef, strSQL As String, strSQL1 As String
Set dbs = CurrentDb

On Error Resume Next
DoCmd.DeleteObject acQuery, "ListTop"

strSQL = "SELECT TOP " & [Forms]![frmSelectVendors]![txtTopCount] & "
tblVendors.VendorID, tblVendors.VendorName,
qryPerformanceDetailExtCost.ExtCost"

Set dbf = DBEngine.Workspaces(0).Databases(0)
Set qdf = dbf.CreateQueryDef("ListTop", strSQL)


End Function

However, my knowledge is limited and I can not get them to work...
Thanks for your help in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top