Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Help

Status
Not open for further replies.

ck1999

Technical User
Dec 2, 2004
784
0
0
US
I know a little about querries but not complicated ones.

I have 2 tables

table1
masterid1
classes <-- This is a string field with comma seperated values


tblclasses
masterID2
field1
field2 <-- This is a string field that has comma seperated values
a bunch of of other fields that are irrelevant

So what I am trying to do is have a query to gather all the field2 values from tblclasses for each masterID in Field 1.

Example

Table1. (1 row of data)
Masterid1 = 1000
classes = Math, PE, Science, English,

tblclasses (1 row of data)
field1 = math
field2 = algebra, geometry, calculus, statistics

next row
field 1 = English
field 2 = american lit, british lit, grammer, essay


The query or code will generate something to the effect of

Where masterid1= 1000
str = algebra, geometry, calculus, statistics, american lit, british lit, grammer, essay

Any ideas?


I am using vb2008 to connect to a access database where the tables are located.

Thanks a lot

Chris
 
Does Master ID1 mean the same thing as Master ID2?

Beir bua agus beannacht!
 
Is there any way you could correct your table structures to be normalized? Where is Master ID2?

Also consider using TGML to format your posts so they are more readable:

Table1. (1 row of data)
[pre]Masterid1 classes
1000 Math, PE, Science, English,[/pre]

tblclasses
[pre]field1 field2
math algebra, geometry, calculus, statistics
English american lit, british lit, grammer, essay
[/pre]

Duane
Hook'D on Access
MS Access MVP
 
Thanks for the responses. I know how to use the code buttons but will look at how to use the Tgml for tables.

MasterID1 and MasterID2 are autonumber for each table.
 
I used the Pre TGML tag to format the table. If masterID1 and 2 are both autonumbers, I can't see how they can stay in synch unless they are not related.

Duane
Hook'D on Access
MS Access MVP
 
Duane,

I do not understand your response.


I want to return all field2 values in table2, if field1 in table2 is contained in the classes field of table1.
The classes field is a comma separated values field


The autonumbers are irrelevant, except using for a where statement


Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top