Solved

recordset.fields collection key values

Posted on 2002-04-12
7
186 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
Comment Utility
Oh yeah.... Thanks!
0
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Accepted Solution

by:
pierrecampe earned 200 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now