Comparing Two Tables w Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two recordsets open in code: one is a list of TableNames and the other
is a list of ItemNames (names of fields for tables in TableNames). Both are
built from code by cycling through all the data tables i have in the
database.

When building the ItemNames table, I would like to retrieve from the
TableNames table the TableID number (field 0) and put it in a field for
TableID for the respective ItemNames.

I think this requires filtering, or finding, or seeking, or something, - to
find the record in TableNames in which the TableName corresponds with the
ItemName and retrieving its ID number. (itemnames are a string of table name
and field name, ie) table ALLCAR has 10 fields, therefore there are ten
ItemNames for ALLCAR --- ALLCAR_BIG, ALLCAR_SMALL, ALLCAR_FLDVAL, etc...

Unfortunately, I can't figure out how...can anybody help?

Thanks,
 
Select the TableID from TableNames that equals the first part of your
ItemNames value.

Dim intPos as Integer
Dim strTableToLookUp as String

intPos = InStr(1, strItemNames, "_") - 1

strTableToLookUp = Left(strItemNames, intPos)

strTableToLookUp should return the left portion of the string in
strItemNames up one to the left of the position of the underscore. Use the
result of that to select the TableID.

Hope that makes sense.
 

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

Back
Top