Now's a fine time to ask but ADO or DAO?

  • Thread starter Thread starter Fred Wilson
  • Start date Start date
Aaron,

Thank you for your very sophisticated and informative answer. I'll give
it some thought. However, please keep in mind, that some of us are
limited by the tools and policies used within out organizations. In my
case we are not allowed to have non-standard items installed on our
machines so locally we are limited to MS Office and its components.

Any of the Oracle and or SQL servers that are in our company are either
leased with their associated systems or they have already been validated
as they are operating.

Maybe I am not smart enough to have figured out that some of the hang
ups I've experienced were from DAO but this is what I am comfortable
with for now.

Once again, thanks for your elegant answer, perhaps you could generate a
periodical or other teaching instruments from this vast knowledge you
are demonstrating.

Humbly,
Fred
 
Aaron,

Thank you for your very sophisticated and informative answer. I'll give
it some thought. However, please keep in mind, that some of us are
limited by the tools and policies used within out organizations. In my
case we are not allowed to have non-standard items installed on our
machines so locally we are limited to MS Office and its components.

Any of the Oracle and or SQL servers that are in our company are either
leased with their associated systems or they have already been validated
as they are operating.

Maybe I am not smart enough to have figured out that some of the hang
ups I've experienced were from DAO but this is what I am comfortable
with for now.

Once again, thanks for your elegant answer, perhaps you could generate a
periodical or other teaching instruments from this vast knowledge you
are demonstrating.

Humbly,
Fred
 
Aaron,

Thank you for your very sophisticated and informative answer. I'll give
it some thought. However, please keep in mind, that some of us are
limited by the tools and policies used within out organizations. In my
case we are not allowed to have non-standard items installed on our
machines so locally we are limited to MS Office and its components.

Any of the Oracle and or SQL servers that are in our company are either
leased with their associated systems or they have already been validated
as they are operating.

Maybe I am not smart enough to have figured out that some of the hang
ups I've experienced were from DAO but this is what I am comfortable
with for now.

Once again, thanks for your elegant answer, perhaps you could generate a
periodical or other teaching instruments from this vast knowledge you
are demonstrating.

Humbly,
Fred
 
Jacob,

I commend you for your tenacity in developing this. I'm sure it was quite a
task putting all the formulas together to build this database. Someday, I'd
like to take a look at the way you did it.

The answer to your question became clear in the very last sentence of your
post. As soon as you used the word "DLookup" I knew that you could probably
increase the speed drastically. Here's some code I wrote to replace DLookup
almost 10 years ago, and updated last year. The idea was given to me by
Trevor Best who wrote a bunch of lookup replacement functions for Access
2.0. This function is pretty generic, so you can use it a lot.:

Public Function FastLookup(strFieldName As String, strTableName As String,
strWhere As String) As Variant
'******************************************************************************************************* ' Name: FastLookup ' Purpose: Fast replacement for DLookup ' Inputs: strFieldName As String ' strTableName As String ' strWhere As String ' Returns: Variant ' Author: Arvin Meyer ' Date: April 9, 1997 ' Updated: June 15, 2005 ' Usage: ' If FastLookup("FieldName", "TableName", "FieldName ='" &Me.txtControlName & "'") = Me.txtControlName Then ' MsgBox "This value exists. Please choose again", vbOKOnly,"Duplicate!" ' Me.txtControlName.SetFocus ' Exit Sub ' End If ' '***************************************************************************************************************On Error GoTo Error_HandlerDim db As DAO.DatabaseDim rst As DAO.RecordsetDim Temp As VariantSet db = CurrentDb If strWhere = "" Then Set rst = db.OpenRecordset("Select [" & strFieldName & "] From [" &strTableName & "]", dbOpenSnapshot) Else Set rst = db.OpenRecordset("Select [" & strFieldName & "] From [" &strTableName & "] Where " & strWhere, dbOpenSnapshot) End If If Not rst.BOF Then rst.MoveFirst Temp = rst(0) Else Temp = Null End If rst.Close FastLookup = TempExit_Here: On Error Resume Next rst.Close Set rst = Nothing Set db = Nothing Exit FunctionError_Handler: MsgBox Err.Number & ": " & Err.Description Resume Exit_HereEnd Function--Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmvp.com"JK" <[email protected]> wrote in messagenews:[email protected]...> Arvin,> (Other please feel free to replay)>> Whilst on the subject, I wander if I can increase speed:>> I have a table that maintains holidays rules/date around the world, 800records so far and growing. There are other "supporting" tables needed, butlet leave it out for now.>> Background:> -------------> Each holiday has its own rule. Some of the rules are simple (eg 25 Dec, or> 4th Thursday in Nov), others are more involved (eg. if an holiday falls ona> weekend, Move it to Monday). Yet others depend on another holiday (eg. 46> days after Easter Sunday).>> In addition, each rule has its own calendar (Gregorian, Hebrew, Islamic sofar) with or without a cross-over, e.g Easter Sunday falls on the FirstSunday after the Jewish Passover (with exceptions)>> I have the relevant routines to calculate the fields "ThisYearDate" and"NextHolidayDate" (not always the same, "US presidential Election" has Nullvalue in isYearDate" (2006) but has a value in "NextHolidayDate", 4 Nov,2008), *NO PROBLEM* thus far.>> Each time a user enter a record, through the OnCurrent event, those twodates get updated through a combination of a Private and a Public Functions.The same happens, through AfterUpdate event of any field that affects therule (Only Admin can do that), still no problem there.>> Regardless of the calendar used to calculate the holiday date, *both*"ThisYearDate" and "NextHolidayDate" return the date in Gregorian calendar,eg. Jewish New Year which is the first day of the year in the Hebrewcalendar will return 23 Sep 2006 (this year) and 13 Sept 2007 (next date)>> The Problem> --------------> Once a year, soon after new year day, I run an update query to update allthe dates in the table. That query runs for about *15 minutes * with 800records, not surprising under the circumstances described above.>> The Question (finally)> ----------------------> Having written those a few years back when I did not understand whatRecordset or DAO means, I wander whether I should modify the routine for ayearly update to reduce the time of a full update. I am in two minds:>> 1. If ain't broken, don't fix it> 2. If I can speed up the operation dramatically using DAO, I can allowusers to do a general update any time.>> Thus far all the calculations are done by whatever DLookup()'s returns.Bearing in mind that if a holiday date is linked to another holiday, thatother holiday has to be calculated first.>> Appreciated your comments>> Regards> Jacob>>>> "Arvin Meyer [MVP]" <[email protected]> wrote in message> If you disambiguate, both can be used. IMO, it would be DAO for most of>> the work. ADO is designed to be faster with SQL-Server and for the most>> part it is. It does not have all the functionality of DAO, but will dothe>> majority of what you may need to do. ADO is not being developed any more>> in favor of ADO.NET. The 2 are not alike. That alone would put a damperon>> my deployment plans.>> -->> Arvin Meyer, MCP, MVP>> http://www.datastrat.com>> http://www.mvps.org/access>> http://www.accessmvp.com>>>> "Fred Wilson" <[email protected]> wrote in message>> Hello all,>>>>>> I have an MS Access 2003 database that I use as a tool to manage some>>> reports and data dumps from an oracle.>>>>>> Anyway, which is the better records set to use, ADO or DAO and why?>>>>>> Thanks,>>> Fred>>>>>>>
 
Maybe MS Access team reccomends that a FAT LAZY RETARDED SENILE
OBSOLETE OLD MAN continue to use MDB format. Maybe they pity you and
they don't think that you have the mental capacity to leave the '90s.


and furthermore, RE:

traditional MDB, DAO, ODBC, and SQL Server as the implementation
approach of
choice for Access clients.


#1) traditional isn't a FAVORABLE WORD. How about 'obsolete' instead.

#2) you fail to mention OLE DB... if you combine MDB and SQL tables
then you're combining 2 different libraries -- and dependencies-- ODBC
and OLE DB. So you have MORE DEPENDENCIES THAN WE DO. You can't do a
clientside TRACE. you can't have a simple consistent 'custom linked
table manager' because you're pulling from 2 different sets of
dependencies; OLEDB and ODBC. It's ridiculous to claim that is
practical or simple.

#3) ADO has been included in Windows for years and years and years and
years.
DAO hasn't been included in Windows for years and years and years
and years.

#4) DAO causes hangs... I don't need to explicity close jack shit your
buggy ass library is DEAD.

#5) MDB can't scale to 25 megabytes for a dozen users. I've had
scalability / stability problems for at least a dozen clients with
'merely 25 mb of data' and a handful of users.

#6) 1 gigabyte isn't enough for a LOT of databases... how do you get
around this? ADP doesn't have this limit. I mean seriously.. what do
you do?

#7) MS Access doesn't have a practical 'Database Tuning Advisor' it
doesn't include any enterprise - level tools like this.

#8) MS Access doesn't have a practical 'Database Profiling' it doesn't
include any enterprise - level tools like this.

#9) SQL Server supports TRIGGERS.. MDB doesn't support triggers.

#10) count the steps to have a form bound to a sproc with 2 parameters
in MDB vs the same task in ADP. it's about 100 steps for you to call
a simple sproc with parameters-- and it's barely a single step for me.


Maybe MS Access team reccomends that a FAT LAZY RETARDED SENILE
OBSOLETE OLD MAN continue to use MDB format. Maybe they pity you and
they don't think that you have the mental capacity to leave the '90s.

But where I come from; ADP is easier to develop than MDB dozens of
reasons.

I don't think that there is a knowledgable person in the world that
seriously thinks that MDB is a serious competitor to SQL Server.

Yes; I would rather you dipshits build in MDB format than in XLS for
example.

But the fact of the matter is that you con your customers into buying
CRIPPLEWARE; ADP is easier to manage; easier to secure.. it doesn't
have a 1gb limit ROFL.. it has free versions for the database SERVER
and most importantly

SQL SERVER WILL UTILIZE ADVANCES IN HARDWARE, INCLUDING LARGE MEMORY
CAPACITIES AND DUAL CORE PROCESSORS.

WITH THE DROP IN HARDWARE PRICES; THE PRACTICALITY OF HAVING A SINGLE
PROCESSOR DUAL CORE DATABASE SERVER WILL FIT ALL OF THE DATABASE
PROCESSING NEEDS OF MANY COMPANIES.

ANYONE THAT USES MDB IS STUCK IN THE 90s..

And I for one-- am sick and tired of being woken up at 3am to deal with
MDB locking problems.

With Access Data Proejcts; you can use Query Hints like 'with (nolock)'
that make multi-user applications practical.

We have real ETL tools; what do you have.. Docmd.TransferDatabase??

ROFL

My OLAP shit is 100,000 times more powerful than any reporting app that
you've built using MS Access.

And I'm talking to each and every one of you MDB idiots.

My OLAP shit is 100,000 times more powerful than any reporting app that
you've built using MS Access.

If MS Access included a free Olap client-- similiar to MS Excel did
with 'offline cubes' and it was practical and simple and performant?

then maybe it would be a decent solution.

but there are 100s of reasons to use SQL Server instead of your silly
little MDB.

And I'm SICK AND ****ING TIRED OF THE DAO BULLSHIT COMING OUT OF YOUR
MOUTH
DAO
 
Larry;

I think that you say things like this so that you can profit
financially-- you are justifying your own antiquated systems-- when ADO
is superior in every fashion.

DAO isn't stable against Access; it isn't practical against SQL Server;
and it just flat out doesn't work against the Oracles and DB2 of this
world.

That to me; means that DAO is an awful friggin choice.

I would like to see that in writing; from someone at Microsoft.
Because I just flat out don't believe you.

because my friend and he works at MSFT... he says the opposite- that
ADP is a great solution for many small medium and larger businesses..
and that MDB can't scale to meet the needs of most medium sized
business

I find the usage of a library-- for example DAO-- that didn't ship in
Windows XP and hasn't been included in MDAC in FIVE YEARS-- I find that
just REVOLTING.

get a ****ing clue jackass there is no DAO revival

there is a new version of ADO in Vista.. is there even a new version of
DAO in Vista?
Or just the new and improved flavor?



-Aaron
 
Fred;

I'm sorry that you think that SQL Server is all big and complex

lose the ****ing training wheels.

Companies that don't have the ability to 'develop in SQL Server' and
'move this to production' have NO ABILITY TO BE SUCCESSFUL IN THE
FUTURE.

Build your company on Jet; and you'll have capacity problems with a
mere 10mb of data

-Aaron
 
DAO isn't included in Access; it's not included as a default reference

there is an ADO connection built into every MDB database in the world..
it's called CurrentProject.connection

CurrentProject.connection.execute

Im so sorry that it's too complex for you.. you should lose the
training wheels you ****ing newbie.

DAO causes crashes and hangs; you have to explicitly close everything--
it pretty much defeats the purpose of writing in VB.

Just because you've been working on databases with only 10 records in
them; that doesn't mean that Joe Q Public should use DAO.

DAO isn't included in half of the Windows desktops on the world!!!

How dare you think that it's appropriate to use this.

Lose the ****ing training wheels kids; you DAO dipshits give us SQL
developers a bad name.


-Aaron
 
Thank you for your very sophisticated and informative answer.

Aaron is a well-known troll whose posts consist of variations on the
theme "MDBs suck." His comments about DAO are just wrong, period, as
is nearly everything he posts. Just ignore everything he says --
that's what everyone else does.
 
**** you mother ****ing pig

you tell me.. does DAO ship with Windows?

Does it ship with MDAC?

eat a ****ing dick you lamer

-Aaron
 
and for the record?

MSDE is a COMPONENT OF OFFICE ITS INCLUDED ON THE OFFICE DISK

just because you work for a backwards ass company and you're stuck in
the 90s; it doesn't mean that DAO is the right route.

DAO is for ****ing retards.. Don't be stuck in the 90s.

-Aaron
 
Not too sure what happened here, but it sure is a mess. I put the code up on
my website, so you don't have to try and decypher the mess below:

http://www.datastrat.com/Code/FastLookup.txt
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Arvin Meyer said:
Jacob,

I commend you for your tenacity in developing this. I'm sure it was quite
a task putting all the formulas together to build this database. Someday,
I'd like to take a look at the way you did it.

The answer to your question became clear in the very last sentence of your
post. As soon as you used the word "DLookup" I knew that you could
probably increase the speed drastically. Here's some code I wrote to
replace DLookup almost 10 years ago, and updated last year. The idea was
given to me by Trevor Best who wrote a bunch of lookup replacement
functions for Access 2.0. This function is pretty generic, so you can use
it a lot.:

Public Function FastLookup(strFieldName As String, strTableName As String,
strWhere As String) As Variant
'*******************************************************************************************************
' Name: FastLookup ' Purpose: Fast replacement for DLookup ' Inputs:
strFieldName As String ' strTableName As String '
strWhere As String ' Returns: Variant ' Author: Arvin Meyer ' Date:
April 9, 1997 ' Updated: June 15, 2005 ' Usage: ' If
FastLookup("FieldName", "TableName", "FieldName ='" &Me.txtControlName &
"'") = Me.txtControlName Then ' MsgBox "This value exists. Please
choose again", vbOKOnly,"Duplicate!" ' Me.txtControlName.SetFocus '
Exit Sub ' End If '
'***************************************************************************************************************On
Error GoTo Error_HandlerDim db As DAO.DatabaseDim rst As DAO.RecordsetDim
Temp As VariantSet db = CurrentDb If strWhere = "" Then Set rst
= db.OpenRecordset("Select [" & strFieldName & "] From [" &strTableName &
"]", dbOpenSnapshot) Else Set rst = db.OpenRecordset("Select ["
& strFieldName & "] From [" &strTableName & "] Where " & strWhere,
dbOpenSnapshot) End If If Not rst.BOF Then rst.MoveFirst
Temp = rst(0) Else Temp = Null End If rst.Close
FastLookup = TempExit_Here: On Error Resume Next rst.Close Set
rst = Nothing Set db = Nothing Exit FunctionError_Handler: MsgBox
Err.Number & ": " & Err.Description Resume Exit_HereEnd Function--Arvin
Meyer, MCP,
MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmvp.com"JK"
messageArvin,> (Other
please feel free to replay)>> Whilst on the subject, I wander if I can
increase speed:>> I have a table that maintains holidays rules/date around
the world, 800records so far and growing. There are other "supporting"
tables needed, butlet leave it out for now.>> Background:> ------------->
Each holiday has its own rule. Some of the rules are simple (eg 25 Dec,
or> 4th Thursday in Nov), others are more involved (eg. if an holiday
falls ona> weekend, Move it to Monday). Yet others depend on another
holiday (eg. 46> days after Easter Sunday).>> In addition, each rule has
its own calendar (Gregorian, Hebrew, Islamic sofar) with or without a
cross-over, e.g Easter Sunday falls on the FirstSunday after the Jewish
Passover (with exceptions)>> I have the relevant routines to calculate the
fields "ThisYearDate" and"NextHolidayDate" (not always the same, "US
presidential Election" has Nullvalue in isYearDate" (2006) but has a value
in "NextHolidayDate", 4 Nov,2008), *NO PROBLEM* thus far.>> Each time a
user enter a record, through the OnCurrent event, those twodates get
updated through a combination of a Private and a Public Functions.The same
happens, through AfterUpdate event of any field that affects therule (Only
Admin can do that), still no problem there.>> Regardless of the calendar
used to calculate the holiday date, *both*"ThisYearDate" and
"NextHolidayDate" return the date in Gregorian calendar,eg. Jewish New
Year which is the first day of the year in the Hebrewcalendar will return
23 Sep 2006 (this year) and 13 Sept 2007 (next date)>> The
Problem> --------------> Once a year, soon after new year day, I run an
update query to update allthe dates in the table. That query runs for
about *15 minutes * with 800records, not surprising under the
circumstances described above.>> The Question
(finally)> ----------------------> Having written those a few years back
when I did not understand whatRecordset or DAO means, I wander whether I
should modify the routine for ayearly update to reduce the time of a full
update. I am in two minds:>> 1. If ain't broken, don't fix it> 2. If I can
speed up the operation dramatically using DAO, I can allowusers to do a
general update any time.>> Thus far all the calculations are done by
whatever DLookup()'s returns.Bearing in mind that if a holiday date is
linked to another holiday, thatother holiday has to be calculated first.>>
Appreciated your comments>> Regards> Jacob>>>> "Arvin Meyer [MVP]"
If you disambiguate, both
can be used. IMO, it would be DAO for most of>> the work. ADO is designed
to be faster with SQL-Server and for the most>> part it is. It does not
have all the functionality of DAO, but will dothe>> majority of what you
may need to do. ADO is not being developed any more>> in favor of ADO.NET.
The 2 are not alike. That alone would put a damperon>> my deployment
plans.>> -->> Arvin Meyer, MCP, MVP>> http://www.datastrat.com>>
http://www.mvps.org/access>> http://www.accessmvp.com>>>> "Fred Wilson"
Hello all,>>>>>> I
have an MS Access 2003 database that I use as a tool to manage some>>>
reports and data dumps from an oracle.>>>>>> Anyway, which is the better
records set to use, ADO or DAO and why?>>>>>> Thanks,>>> Fred>>>>>>>
 
a dependency to 'DAO' is ridiculous in a DLookup replacement

you should use ADO; jackass

-Aaron


Jacob,

I commend you for your tenacity in developing this. I'm sure it was quite a
task putting all the formulas together to build this database. Someday, I'd
like to take a look at the way you did it.

The answer to your question became clear in the very last sentence of your
post. As soon as you used the word "DLookup" I knew that you could probably
increase the speed drastically. Here's some code I wrote to replace DLookup
almost 10 years ago, and updated last year. The idea was given to me by
Trevor Best who wrote a bunch of lookup replacement functions for Access
2.0. This function is pretty generic, so you can use it a lot.:

Public Function FastLookup(strFieldName As String, strTableName As String,
strWhere As String) As Variant
'******************************************************************************************************* ' Name: FastLookup ' Purpose: Fast replacement for DLookup ' Inputs: strFieldName As String ' strTableName As String ' strWhere As String ' Returns: Variant ' Author: Arvin Meyer ' Date: April 9, 1997 ' Updated: June 15, 2005 ' Usage: ' If FastLookup("FieldName", "TableName", "FieldName ='" &Me.txtControlName & "'") = Me.txtControlName Then ' MsgBox "This value exists. Please choose again", vbOKOnly,"Duplicate!" ' Me.txtControlName.SetFocus ' Exit Sub ' End If ' '***************************************************************************************************************On Error GoTo Error_HandlerDim db As DAO.DatabaseDim rst As DAO.RecordsetDim Temp As VariantSet db = CurrentDb If strWhere = "" Then Set rst = db.OpenRecordset("Select [" & strFieldName & "] From [" &strTableName & "]", dbOpenSnapshot) Else Set rst = db.OpenRecordset("Select [" & strFieldName & "] From [" &strTableName & "] Where " & strWhere, dbOpenSnapshot) End If If Not rst.BOF Then rst.MoveFirst Temp = rst(0) Else Temp = Null End If rst.Close FastLookup = TempExit_Here: On Error Resume Next rst.Close Set rst = Nothing Set db = Nothing Exit FunctionError_Handler: MsgBox Err.Number & ": " & Err.Description Resume Exit_HereEnd Function--Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmvp.com"JK" <[email protected]> wrote in messagenews:[email protected]...> Arvin,> (Other please feel free to replay)>> Whilst on the subject, I wander if I can increase speed:>> I have a table that maintains holidays rules/date around the world, 800records so far and growing. There are other "supporting" tables needed, butlet leave it out for now.>> Background:> -------------> Each holiday has its own rule. Some of the rules are simple (eg 25 Dec, or> 4th Thursday in Nov), others are more involved (eg. if an holiday falls ona> weekend, Move it to Monday). Yet others depend on another holiday (eg. 46> days after Easter Sunday).>> In addition, each rule has its own calendar (Gregorian, Hebrew, Islamic sofar) with or without a cross-over, e.g Easter Sunday falls on the FirstSunday after the Jewish Passover (with exceptions)>> I have the relevant routines to calculate the fields "ThisYearDate" and"NextHolidayDate" (not always the same, "US presidential Election" has Nullvalue in isYearDate" (2006) but has a value in "NextHolidayDate", 4 Nov,2008), *NO PROBLEM* thus far.>> Each time a user enter a record, through the OnCurrent event, those twodates get updated through a combination of a Private and a Public Functions.The same happens, through AfterUpdate event of any field that affects therule (Only Admin can do that), still no problem there.>> Regardless of the calendar used to calculate the holiday date, *both*"ThisYearDate" and "NextHolidayDate" return the date in Gregorian calendar,eg. Jewish New Year which is the first day of the year in the Hebrewcalendar will return 23 Sep 2006 (this year) and 13 Sept 2007 (next date)>> The Problem> --------------> Once a year, soon after new year day, I run an update query to update allthe dates in the table. That query runs for about *15 minutes * with 800records, not surprising under the circumstances described above.>> The Question (finally)> ----------------------> Having written those a few years back when I did not understand whatRecordset or DAO means, I wander whether I should modify the routine for ayearly update to reduce the time of a full update. I am in two minds:>> 1. If ain't broken, don't fix it> 2. If I can speed up the operation dramatically using DAO, I can allowusers to do a general update any time.>> Thus far all the calculations are done by whatever DLookup()'s returns.Bearing in mind that if a holiday date is linked to another holiday, thatother holiday has to be calculated first.>> Appreciated your comments>> Regards> Jacob>>>> "Arvin Meyer [MVP]" <[email protected]> wrote in message> news:[email protected]...>> If you disambiguate, both can be used. IMO, it would be DAO for most of>> the work. ADO is designed to be faster with SQL-Server and for the most>> part it is. It does not have all the functionality of DAO, but will dothe>> majority of what you may need to do. ADO is not being developed any more>> in favor of ADO.NET. The 2 are not alike. That alone would put a damperon>> my deployment plans.>> -->> Arvin Meyer, MCP, MVP>> http://www.datastrat.com>> http://www.mvps.org/access>> http://www.accessmvp.com>>>> "Fred Wilson" <[email protected]> wrote in message>> news:[email protected]...>>> Hello all,>>>>>> I have an MS Access 2003 database that I use as a tool to manage some>>> reports and data dumps from an oracle.>>>>>> Anyway, which is the better records set to use, ADO or DAO and why?>>>>>> Thanks,>>> Fred>>>>>>>
 
Many thanks Arvin,

Got it and will look at it.

I'm a happy for you to have the relevant DB, I sent it to your Datastart
mail address. Please let me know if received ok.

Regards
Jacob

Arvin Meyer said:
Not too sure what happened here, but it sure is a mess. I put the code up
on my website, so you don't have to try and decypher the mess below:

http://www.datastrat.com/Code/FastLookup.txt
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Arvin Meyer said:
Jacob,

I commend you for your tenacity in developing this. I'm sure it was quite
a task putting all the formulas together to build this database. Someday,
I'd like to take a look at the way you did it.

The answer to your question became clear in the very last sentence of
your post. As soon as you used the word "DLookup" I knew that you could
probably increase the speed drastically. Here's some code I wrote to
replace DLookup almost 10 years ago, and updated last year. The idea was
given to me by Trevor Best who wrote a bunch of lookup replacement
functions for Access 2.0. This function is pretty generic, so you can use
it a lot.:

Public Function FastLookup(strFieldName As String, strTableName As
String, strWhere As String) As Variant
'*******************************************************************************************************
' Name: FastLookup ' Purpose: Fast replacement for DLookup ' Inputs:
strFieldName As String ' strTableName As String ' strWhere As
String ' Returns: Variant ' Author: Arvin Meyer ' Date: April 9, 1997 '
Updated: June 15, 2005 ' Usage: ' If FastLookup("FieldName", "TableName",
"FieldName ='" &Me.txtControlName & "'") = Me.txtControlName Then '
MsgBox "This value exists. Please choose again", vbOKOnly,"Duplicate!" '
Me.txtControlName.SetFocus ' Exit Sub ' End If '
'***************************************************************************************************************On
Error GoTo Error_HandlerDim db As DAO.DatabaseDim rst As DAO.RecordsetDim
Temp As VariantSet db = CurrentDb If strWhere = "" Then Set rst
= db.OpenRecordset("Select [" & strFieldName & "] From [" &strTableName &
"]", dbOpenSnapshot) Else Set rst = db.OpenRecordset("Select ["
& strFieldName & "] From [" &strTableName & "] Where " & strWhere,
dbOpenSnapshot) End If If Not rst.BOF Then rst.MoveFirst
Temp = rst(0) Else Temp = Null End If rst.Close
FastLookup = TempExit_Here: On Error Resume Next rst.Close Set
rst = Nothing Set db = Nothing Exit FunctionError_Handler:
MsgBox Err.Number & ": " & Err.Description Resume Exit_HereEnd
Function--Arvin Meyer, MCP,
MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmvp.com"JK"
messageArvin,> (Other
please feel free to replay)>> Whilst on the subject, I wander if I can
increase speed:>> I have a table that maintains holidays rules/date
around the world, 800records so far and growing. There are other
"supporting" tables needed, butlet leave it out for now.>>
Background:> -------------> Each holiday has its own rule. Some of the
rules are simple (eg 25 Dec, or> 4th Thursday in Nov), others are more
involved (eg. if an holiday falls ona> weekend, Move it to Monday). Yet
others depend on another holiday (eg. 46> days after Easter Sunday).>> In
addition, each rule has its own calendar (Gregorian, Hebrew, Islamic
sofar) with or without a cross-over, e.g Easter Sunday falls on the
FirstSunday after the Jewish Passover (with exceptions)>> I have the
relevant routines to calculate the fields "ThisYearDate"
and"NextHolidayDate" (not always the same, "US presidential Election" has
Nullvalue in isYearDate" (2006) but has a value in "NextHolidayDate", 4
Nov,2008), *NO PROBLEM* thus far.>> Each time a user enter a record,
through the OnCurrent event, those twodates get updated through a
combination of a Private and a Public Functions.The same happens, through
AfterUpdate event of any field that affects therule (Only Admin can do
that), still no problem there.>> Regardless of the calendar used to
calculate the holiday date, *both*"ThisYearDate" and "NextHolidayDate"
return the date in Gregorian calendar,eg. Jewish New Year which is the
first day of the year in the Hebrewcalendar will return 23 Sep 2006 (this
year) and 13 Sept 2007 (next date)>> The Problem> --------------> Once a
year, soon after new year day, I run an update query to update allthe
dates in the table. That query runs for about *15 minutes * with
800records, not surprising under the circumstances described above.>> The
Question (finally)> ----------------------> Having written those a few
years back when I did not understand whatRecordset or DAO means, I wander
whether I should modify the routine for ayearly update to reduce the time
of a full update. I am in two minds:>> 1. If ain't broken, don't fix it>
2. If I can speed up the operation dramatically using DAO, I can
allowusers to do a general update any time.>> Thus far all the
calculations are done by whatever DLookup()'s returns.Bearing in mind
that if a holiday date is linked to another holiday, thatother holiday
has to be calculated first.>> Appreciated your comments>> Regards>
If you disambiguate, both
can be used. IMO, it would be DAO for most of>> the work. ADO is designed
to be faster with SQL-Server and for the most>> part it is. It does not
have all the functionality of DAO, but will dothe>> majority of what you
may need to do. ADO is not being developed any more>> in favor of
ADO.NET. The 2 are not alike. That alone would put a damperon>> my
deployment plans.>> -->> Arvin Meyer, MCP, MVP>>
http://www.datastrat.com>> http://www.mvps.org/access>>
http://www.accessmvp.com>>>> "Fred Wilson" <[email protected]>
wrote in message>>
Hello all,>>>>>>
I have an MS Access 2003 database that I use as a tool to manage some>>>
reports and data dumps from an oracle.>>>>>> Anyway, which is the better
records set to use, ADO or DAO and why?>>>>>> Thanks,>>> Fred>>>>>>>
 
David said:
Aaron is a well-known troll whose posts consist of variations on the
theme "MDBs suck." His comments about DAO are just wrong, period, as
is nearly everything he posts.

Well, his approach may be 'Sling enough mud..." but, sure enough, some
of it does stick e.g. I've always found it difficult to justify in this
day and age the need to manually 'compact and repair'.

Jamie.

--
 
well spoken



Jamie said:
Well, his approach may be 'Sling enough mud..." but, sure enough, some
of it does stick e.g. I've always found it difficult to justify in this
day and age the need to manually 'compact and repair'.

Jamie.

--
 
David;

I'm so sorry that you're a fat lazy dipshit that's stuck in the 80s.

I'm not going to let you spread misinformation.

JET IS DEAD AND SO IS DAO.

SQL Server / Access Data Projects has been out for 10 years; kids
lose the training wheels and move into the 21st century

-Aaron
 

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

Similar Threads

DAO vs ADO 5
ADO vs DAO 14
ADO vs. DAO 35
ACC2003/2007 + SQL Server ADO or DAO 10
DAO IS DED 16
ado upgrade or dao 3
DAO to ADO 1
Should I Learn DAO, ADO or ADO.NET ? 2

Back
Top