Solved

recordset.fields collection key values

Posted on 2002-04-12
7
188 Views
Last Modified: 2008-03-06
I've got a problem with DAO, DB, and recordset objects acting slightly different on two different PCs.  Both PCs have MS DAO version 2.6 installed, which is where I thought the problem would be.  Anyway, I'm creating/opening a recordset in which I'm joining 2 tables.  I'm using "select * from table1, table2 where....".  I'm accessing the recordset.fields("xxx") collection using the key, "xxx", of the column name from the select.  For duplicate column names across both tables, PC-1 (along with most other PCs in my user community) is building the collection with key "COLUMN_NAME" and “COLUMN_NAME1".  PC-2 is building the collection with keys "COLUMN_NAME1" and "COLUMN_NAME2".  I know I can list the column names explicitly in the select to avoid the problem, but I really want to find out the source of the problem.

Question: Do you guys know what shared file, DLL, Type lib, whatever... might be "responsible" for building the recordset.fields collection, or anything else that might be the source of the difference in building the recordset.fields collection.  (I’ve used a utility “Dependency Walker” to compare the files and versions associated with DAO and everything seems to be ok.)
0
Comment
Question by:hildebrand
  • 4
  • 2
7 Comments
 

Author Comment

by:hildebrand
ID: 6936960
Oh yeah.... Thanks!
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6937050
Personally I would avoid this sort of problem at source by using

"Select Table1.Field As T1Field, Table2.Field As T2Field"

Or similar in your select statement.
0
 

Author Comment

by:hildebrand
ID: 6937268
I've written the code to work with dynamic table/column names on the server DB.  I know there are arguments against doing this, but out client software distribution method is not very timely or easy, so updating the source is not my best option.  If I have to do it that way I will, but I'm still hoping to find out what's creating the collection keys differently.  Thanks anyway!
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 6

Accepted Solution

by:
pierrecampe earned 200 total points
ID: 6937715
i have no idea what may be causing the problem
but a way to avoid it is not to use the column names but the column positions:
recordset.fields(0) to recordset.fields(recordset.fields.count-1)
0
 

Author Comment

by:hildebrand
ID: 6950605
Thanks.  I can use the column position to cycle through the objects and use the .name property to match before contining with the .value.  This works fine.
Thanks again!
0
 
LVL 6

Expert Comment

by:pierrecampe
ID: 6954936
Hey what's with the 'C' grade
if you dont like a suggestion then DO NOT accept it as an answer
I have a record of almost 100 straight 'A' grades and now thanks to you there is a 'C' in it
well dont count on me anymore to try to help you out in ANY way

0
 

Author Comment

by:hildebrand
ID: 6954965
Sorry man,  didn't know the grade point average was so important.  Are you using it to get into college.  Really.  Can I change it?  I will.  I was hoping someone would point me to the code where the keys are generated.  You didn't do that, so I thought a 'C' was appropriate.  I knew I could use the index into the collection.  I thought the 200 points were nice.  I'm a novice at experts exchange, so I'm not quite sure what's important and what's not.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question