Tom Bolton
tom.bolton at donnslaw.co.uk
Fri Feb 11 03:21:14 CST 2005
My apologies, I should've made myself clearer there. Didn't have the chance to either, as a lot of you guys are in the US and don't get up until lunchtime!! ;-) (our lunchtime anyway) I just remember the pain when I took on a VB project that referenced both DAO and ADO (set the references initially in Tools > References on a per-project basis) and didn't know anything about DIMing the objects as ADODB.Recordset etc. I'm told one's code also runs faster with unambiguous declarations... -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: 10 February 2005 21:41 To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Question on Reference (DAO) Lol, of course. JGTS that I am more fluent in DAO than ADO. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Thursday, February 10, 2005 4:21 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Question on Reference (DAO) The only correction I'll suggest to that, John, is that the reference is to an ADODB.Recordset, etc. Charlotte Foust -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Thursday, February 10, 2005 12:11 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Question on Reference (DAO) John, What he is saying is that you explicitly reference the lib in the dim statement. Dim db as DAO.Database Dim rst as DAO.Recordset ADO has a recordset method that returns a recordset object Dim rst as ADO.Recordset If you just say Dim rst as Recordset And you have referenced both the ADO and DAO libraries, then the object returned will be an ADO recordset if that is higher in the list of referenced objects, and a DAO object if that is higher in the list of referenced objects. By specifically stating: Dim rst as DAO.Recordset You are unambiguously telling the compiler to get a DAO recordset object. Likewise: Dim rst as ADO.Recordset tells the compiler to get an ADO recordset object. If you reference both the DAO and ADO libs, you always SHOULD specify which object you are after. You don't literally have to, but what you get back will depend on reference order and thus could change if someone changed the order that the libs are referenced. NOT a good thing! John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Clark Sent: Thursday, February 10, 2005 2:57 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Question on Reference (DAO) Do I reference them via code, or on each PC that runs the program? Or, does it follow through after I set the reference while programming it? >>> tom.bolton at donnslaw.co.uk 2/10/2005 3:58 AM >>> Hear hear! I've found this too - not having used DAO for years I shied away from it when returning to an Access project but it's noticeably quicker when using it for native Access objects. Access was after all designed around DAO/Jet. I can't stress enough what Charlotte said: if you use a mixture of DAO and ADO, REFERENCE THEM EXPLICITLY! (ADODB.Recordset, DAO.Database etc.) You'll be in a whole world of pain otherwise. Cheers Tom -----Original Message----- From: Bobby Heid [mailto:bheid at appdevgrp.com] Sent: 09 February 2005 19:27 To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Question on Reference (DAO) It is my understanding that when accessing native Access databases, that DAO is the best performer. If you will be accessing SQL Server or other OLE databases, use ADO. Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Clark Sent: Wednesday, February 09, 2005 1:51 PM To: accessd at databaseadvisors.com Subject: [AccessD] Question on Reference (DAO) I am working on a new program in A2K. Most of my older existing stuff is A97, and I just used some old code which had a problem. Basically, I took some code I was using, from an A97 db, to add items to a combo on NotInList...I think the code was originally written by Dev Ashish. I got a "reference" error, so I went into the references and added Microsoft DAO 3.6 object library, and it is working now. My question is this; is this alright, or should I have adapted the code to fit 2K? Is there any penalty that I risk (i.e. speed, etc.) by keeping it this way? Thanks, John W Clark -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -------------- next part -------------- The contents of this message and any attachments are the property of Donns Solicitors and are intended for the confidential use of the named recipient only. They may be legally privileged and should not be communicated to, or relied upon, by any other party without our written consent. If you are not the addressee, please notify us immediately so that we can make arrangements for its return. You should not show this e-mail to any person or take copies as you may be committing a criminal or civil offence for which you may be liable. The statement and opinions expressed in this e-mail message are those of the writer, and do not necessarily represent that of Donns Solicitors. Although any files attached to this e-mail will have been checked with virus protection software prior to transmission, you should carry out your own virus check before opening any attachment. Donns Solicitors does not accept any liability for any damage or loss which may be caused by software viruses...