PC Review
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Comparing Two Tables w Code
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Comparing Two Tables w Code
![]() |
Comparing Two Tables w Code |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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, |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

