what's new in dao? · with dao, you can set the partialreplica property on a relation which...

656
What's New in DAO? DAO 3.5 introduces a new client/server connection mode, called "ODBCDirect ." ODBCDirect establishes a connection directly to an ODBC data source , without loading the Microsoft Jet database engine into memory, and is useful in situations where specific features of ODBC are required. For Microsoft Jet databases , there are also new interfaces to expose Microsoft Jet's new partial replication feature. Note You can send DAO queries to a variety of different database servers with ODBCDirect, and different servers will recognize slightly different dialects of SQL. Therefore, context-sensitive Help is no longer provided for Microsoft Jet SQL, although online Help for Microsoft Jet SQL is still included through the Help menu. Be sure to check the appropriate reference documentation for the SQL dialect of your database server when using either ODBCDirect connections or pass-through queries in Microsoft Jet-connected client/server applications.

Upload: others

Post on 19-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

What'sNewinDAO?

DAO3.5introducesanewclient/serverconnectionmode,called"ODBCDirect."ODBCDirectestablishesaconnectiondirectlytoanODBCdatasource,withoutloadingtheMicrosoftJetdatabaseengineintomemory,andisusefulinsituationswherespecificfeaturesofODBCarerequired.

ForMicrosoftJetdatabases,therearealsonewinterfacestoexposeMicrosoftJet'snewpartialreplicationfeature.

NoteYoucansendDAOqueriestoavarietyofdifferentdatabaseserverswithODBCDirect,anddifferentserverswillrecognizeslightlydifferentdialectsofSQL.Therefore,context-sensitiveHelpisnolongerprovidedforMicrosoftJetSQL,althoughonlineHelpforMicrosoftJetSQLisstillincludedthroughtheHelpmenu.BesuretochecktheappropriatereferencedocumentationfortheSQLdialectofyourdatabaseserverwhenusingeitherODBCDirectconnectionsorpass-throughqueriesinMicrosoftJet-connectedclient/serverapplications.

Page 2: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NewDAO3.5InterfacesforODBCDirect

Connectionobject—AconnectiontoanODBCdatabase.

Cancelmethod(onConnection,QueryDef,andRecordsetobjects)—Cancelsexecutionofanasynchronousoperation.

NextRecordsetmethod(onRecordsetobjects)—Retrievesthenextsetofrecords,ifany,returnedbyaquerythatreturnedmultiplesetsofrecordsinanOpenRecordsetcall,andindicateswhetheritsuccessfullyretrievedanothersetofrecords.

OpenConnectionmethod(onWorkspaceobjects)—OpensaConnectionobjectonanODBCdatasource.

BatchCollisionCountproperty(onRecordsetobjects)—Returnsthenumberofrecordsthatdidnotcompleteduringthelastbatchupdate.

BatchCollisionsproperty(onRecordsetobjects)—Returnsanarrayofbookmarksindicatingtherowsthatgeneratedcollisionsinthelastbatchupdate.

BatchSizeproperty(onRecordsetobjects)—Setsorreturnsthenumberofstatementssentbacktotheserverineachbatch.

Connectionproperty(onDatabaseandRecordsetobjects)—ReturnstheConnectionobjectthatcorrespondstotheDatabase,

Page 3: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

orthatownstheRecordset.

Databaseproperty(onConnectionobjects)—ReturnsthenameoftheDatabaseobjectthatcorrespondstotheConnection.

DefaultCursorDriverproperty(onWorkspaceobjects)—SetsorreturnsthetypeofcursordriverusedforODBCDirectRecordsetobjects.

DefaultTypeproperty(onDBEngineobject)—Indicateswhattypeofworkspace(MicrosoftJetorODBCDirect)willbecreatedbythenextCreateWorkspacemethodcall.

Directionproperty(onParameterobjects)—IndicateswhetheraParameterobjectrepresentsaninputparameter,anoutputparameter,orboth,oriftheparameteristhereturnvaluefromastoredprocedure.

MaxRecordsproperty(onQueryDefobjects)—Setsorreturnsthemaximumnumberofrecordstoreturnfromaquery.

OriginalValueproperty(onFieldobjects)—ReturnsthevalueofaFieldinthedatabasethatexistedwhenthelastbatchupdatebegan.

Prepareproperty(onQueryDefobjects)—ReturnsavaluethatindicateswhetherthequeryshouldbepreparedontheserverasatemporarystoredprocedurewiththeODBCSQLPrepare

Page 4: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

functionpriortoexecution,orjustexecutedusingtheODBCSQLExecDirectfunction.

RecordStatusproperty(onRecordsetobjects)—Returnsavaluethatindicatestheupdatestatusofthecurrentrecordifitispartofabatchupdate.

StillExecutingproperty(onConnection,QueryDef,andRecordsetobjects)—Returnsavalueindicatingwhetherornotanasynchronousoperationhasfinishedexecuting.

UpdateOptionsproperty(onRecordsetobjects)—ReturnsavaluethatindicateshowtheWHEREclauseisconstructedforeachrecordduringabatchupdate,andhowtheupdateshouldbeexecuted.

VisibleValueproperty(onRecordsetobjects)—ReturnsavaluecurrentlyinthedatabasethatisnewerthantheOriginalValuepropertyasdeterminedbyabatchupdateconflict.

Page 5: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NewCapabilitieswithODBCDirectServerConnections

AvailableonlyintheODBCDirectobjectmodel,thenewConnectionobjectcontainsinformationaboutaconnectiontoanODBCdatasource,suchastheservername,thedatasourcename,andsoon.ItissimilartoaDatabaseobject,andwilllookveryfamiliarifyou'veeveropenedaDatabaseobjectonanODBCdatasource.Infact,aConnectionobjectandaDatabaseobjectrepresentdifferentreferencestothesameobject,andnewpropertiesoneachofthesetwoobjecttypesallowyoutoobtainareferencetotheothercorrespondingobject,whichsimplifiesthetaskofconvertingexistingODBCclientapplicationsthatuseMicrosoftJettouseODBCDirectinstead.

BatchUpdates

Anewbatchupdatecursorisavailableforclientapplicationsthatneedtoworkwithacursorwithoutholdinglocksontheserverorissueupdaterequestsonerecordatatime.Instead,theclientstoresupdateinformationonmanyrecordsinalocalbuffer(or"batch"),andthenissuesabatchupdate.

BecauseofthetimelagbetweenopeningaRecordsetandsendingabatchofupdatesfromthatRecordsetbacktotheserver,otherusershaveanopportunitytochangetheoriginaldatabeforeyourchangesaresenttotheserver,soyourchanges"collide"withanotheruser'schanges.Severalnewfeaturesareavailabletohelpyoudeterminewheresuchcollisionshaveoccurred,followingabatchupdate,andgiveyousomeoptionsforresolvingthem.

AsynchronousMethodExecution

TheExecute,MoveLast,OpenConnection,andOpenRecordsetmethodsfeaturethedbRunAsyncoption.Thisallowstheclientapplicationtodoothertasks(suchasloadingforms,andsoon)whilethemethodisexecuting.Youcanalsopolltoseewhetherthetaskis

Page 6: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

complete,andterminateanasynchronoustask.

ClientSupportforODBCCursors

FourdifferentRecordsettypessupportthefollowingODBCcursortypes:

ODBCCursor RecordsettypeDynamic dbOpenDynamic(NewinDAO3.5)Dynaset dbOpenDynaset

Forward-Only dbOpenForwardOnly(NewinDAO3.5)

Static dbOpenSnapshot

Page 7: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NewDAO3.5InterfacesfortheMicrosoftJetDatabaseEngine

PopulatePartialmethod(onDatabaseobjects)—Synchronizesanychangesinapartialreplicawiththefullreplica,clearsallrecordsinthepartialreplica,andthenrepopulatesthepartialreplicabasedonthecurrentreplicafilters.

SetOptionmethod(onDBEngineobject)—OverridestheregistryvaluesfortheMicrosoftJetdatabaseengineforthedurationofthecurrentinstanceofDAO.

FieldSizeproperty(onFieldobjects)—ReplacestheFieldSizemethod.Syntactically,theirusageisthesame,sothiswillnotrequirechangestoyourexistingcode.

MaxRecordsproperty(onQueryDefobjects)—Setsorreturnsthemaximumnumberofrecordstoreturnfromaquery.

ReplicaFilterproperty(onTableDefobjects)—Returnsavaluethatindicateswhichsubsetofrecordsisreplicatedtothattablefromafullreplica.

PartialReplicaproperty(onRelationobjects)—IndicateswhichRelationobjectshouldbeconsideredwhenpopulatingapartialreplicafromafullreplica.

Page 8: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NewCapabilitieswiththeMicrosoftJetDatabaseEnginePartialReplication

Version3.5oftheMicrosoftJetdatabaseengineallowsuserstoreplicateportionsofatableinsteadofthewholetable(onlyrowrestrictionsarepermitted,notcolumns).Therearetwotypesoffiltersusedinapartialreplica—Booleanandrelationship.Booleanfiltersselectonlyrowsthatmeetacertaincriteriatolimittherowsinatablethatarereplicated.DAOrepresentsthisfilterwiththeReplicaFilterpropertyonaTableDef.Relationshipfiltersenforcearelationshipbetweenpartiallyreplicatedtablestolimittherowsinatablethatarereplicated.WithDAO,youcansetthePartialReplicapropertyonaRelationwhichallowsthatRelationtobeusedinpartialreplication.

NewRecordsetType

InDAO3.5,dbOpenForwardOnlyisanewtypeargumentfortheOpenRecordsetmethod.ThisnewRecordsettypebehavesinthesamewayasaDAO3.0snapshot-typeRecordsetopenedwiththedbForwardOnlyoption.

Run-timeRegistryOverride

ThenewSetOptionmethodallowsyoutooverrideMicrosoftJetRegistrysettingsatruntime.ThisletsyoufinetuneMicrosoftJetqueryperformance,timeoutdelays,andsoon.

Page 9: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOOverview

DAOenablesyoutouseaprogramminglanguagetoaccessandmanipulatedatainlocalorremotedatabases,andtomanagedatabases,theirobjects,andtheirstructure.

Page 10: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ObjectModelsDAOsupportstwodifferentdatabaseenvironments,or"workspaces."

MicrosoftJetworkspacesallowyoutoaccessdatainMicrosoftJetdatabases,MicrosoftJet-connectedODBCdatabases,andinstallableISAMdatasourcesinotherformats,suchasParadoxorLotus1-2-3.

ODBCDirectworkspacesallowyoutoaccessdatabaseserversthroughODBC,withoutloadingtheMicrosoftJetdatabaseengine.

UsetheMicrosoftJetworkspacewhenyouopenaMicrosoftJetdatabase(.mdbfile)orotherdesktopISAMdatabase,orwhenyouneedtotakeadvantageofMicrosoftJet'suniquefeatures,suchastheabilitytojoindatafromdifferentdatabaseformats.

TheODBCDirectworkspaceprovidesanalternativewhenyouonlyneedtoexecutequeriesorstoredproceduresagainstaback-endserver,suchasMicrosoftSQLServer,orwhenyourclientapplicationneedsthespecificcapabilitiesofODBC,suchasbatchupdatesorasynchronousqueryexecution.

DAOObjects

Thereare17differentDAOobjecttypes.YoucandeclarenewDAOobjectvariablesforanyoftheobjecttypes.

Forexample,thefollowingVisualBasicforApplications(VBA)codecreatesobjectvariablesforaDatabaseobject,adynaset-typeRecordsetobject,andaFieldobject:

DimdbsExampleAsDatabaseDimrstExampleAsRecordset

Page 11: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DimfldExampleAsField

SetdbsExample=OpenDatabase("Biblio.mdb")SetrstExample=dbsExample.OpenRecordset("Authors",_dbOpenDynaset)SetfldExample=rstExample.Fields("Au_ID")

DAOCollections

EachDAOobjecttypeotherthanDBEnginealsohasacorrespondingcollection.Acollectionincludesalltheexistingobjectsofthattype.Forexample,theRecordsetscollectioncontainsallopenRecordsetobjects.Eachcollectionis"owned"byanotherobjectatthenexthigherlevelinthehierarchy.ADatabaseobject"owns"aRecordsetscollection.ExceptfortheConnectionandErrorobjects,everyDAOobjecthasaPropertiescollection.

MostDAOobjectshavedefaultcollectionsanddefaultproperties.Forexample,thedefaultcollectionofaRecordsetobjectistheFieldscollectionandthedefaultpropertyofaFieldobjectistheValueproperty.Youcansimplifyyourcodebytakingadvantageofthesedefaults.Forexample,thefollowingcodesetsthevalueofthePubIDfieldinthecurrentrecord:

rstExample!PubID=99

DBENGINEANDWORKSPACEOBJECTS

AllDAOobjectsarederivedfromtheDBEngineobject.YoucansettheDefaultTypepropertyontheDBEngineobjecttodeterminetheworkspacetype(MicrosoftJetorODBCDirect)tocreateonsubsequentCreateWorkspacemethodcalls,oryoucanoverridethispropertywiththetypeargumentintheCreateWorkspacemethoditself.Whenyourapplicationcreatesaworkspace,theappropriatelibrary—theMicrosoftJetdatabaseengineorODBC—isloadedintomemoryatthattime.

YoucanopenadditionalWorkspaceobjectsasneeded.EachWorkspaceobjecthasauserIDandpasswordassociatedwithit.

Page 12: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsingtheMicrosoftJetWorkspaceOpeningaDatabase

Toopenadatabase,yousimplyopenanexistingDatabaseobject,orcreateanewone.ThisobjectcanrepresentaMicrosoftJetdatabase(.mdbfile),anISAMdatabase(forexample,Paradox),oranODBCdatabaseconnectedthroughtheMicrosoftJetdatabaseengine(alsoknownasa"MicrosoftJet-connectedODBCdatabase").

Data-DefinitionLanguage

YoucanuseobjectvariablesandotherDDLfeaturestomodifyyourdatabasestructure.Forexample,youcanaddanewFieldobjecttoanexistingtablewiththefollowingcode:

DimdbsAsDatabase,tdfAsTableDef,fldAsField'Openadatabase.Setdbs=OpenDatabase("Biblio.mdb")'OpenaTableDef.Settdf=dbs.TableDefs("Authors")'Createanewfield.Setfld=tdf.CreateField("Address",dbText,20)'AppendfieldtotheTableDefFieldscollection.tdf.Fields.Appendfld

ThiscodecreatesanewobjectvariableforaFieldobjectandaddsittoaTableDefobjectwiththeAppendmethod.BecauseaTableDefobjectcontainsthedefinitionofatable,thetablenowhasafieldnamedAddressforenteringdata.Inmuchthesameway,youcancreatenewtablesandnewindexes.

DataManipulation

DAOprovidesanexcellentsetofdatamanipulationtools.YoucancreateaRecordsetobjecttoconvenientlyqueryadatabaseandmanipulatethe

Page 13: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

resultingsetofrecords.TheOpenRecordsetmethodacceptsanSQLstring,oraQueryDef(storedquery)nameasadatasourceargument,oritcanbeopenedfromaQueryDefobjectoraTableDefobject,usingthatobjectasitsdatasource.TheresultingRecordsetobjectfeaturesanextremelyrichsetofpropertiesandmethodswithwhichtobrowseandmodifydata.

TheRecordsetobjectisavailableinfourdifferenttypes—Table,Dynaset,Forward-Only,andSnapshot.

Transactions

AllDatabaseobjectsopenedagainstaWorkspaceobjectshareacommontransactionscope.Thatis,whenyouusetheBeginTransmethodonaWorkspaceobject,itappliestoallopendatabaseswithinthatWorkspaceobject.Inthesameway,whenyouusetheCommitTransmethodagainsttheWorkspace,itappliestoallopendatabasesintheWorkspaceobject.

Replication

YoucanusedatabasereplicationtocreateandmaintainreplicasofamasterMicrosoftJetdatabase,usingtheSynchronizemethodtoperiodicallyupdateallorpartofthereplicas,ortocopynewdatafromonereplicatoanother.Youcanalsorestricttheupdatetoonlyselectedrecords,usingtheReplicaFilterproperty,andthensynchronizethoserecordswiththePopulatePartialmethod.

Security

Youcanrestrictaccesstooneormore.mdbdatabasesortheirtablesusingsecuritysettingsestablishedandmanagedbytheMicrosoftJetdatabaseengine.Inyourcode,youcanestablishGroupandUserobjectstodefinethescopeandlevelofpermissionsavailabletoindividualusersonanobject-by-objectbasis.Forexample,youcanestablishpermissionsforaspecificusertoprovideread-onlyaccesstoonetableandfullaccesstoanother.

Page 14: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsingtheODBCDirectObjectModelConnectingtoaDatabase

AConnectionobjectissimilartoaDatabaseobject.Infact,aConnectionobjectandaDatabaseobjectrepresentdifferentreferencestothesameobject,andpropertiesoneachofthesetwoobjecttypesallowyoutoobtainareferencetotheothercorrespondingobject,whichsimplifiesthetaskofconvertingODBCclientapplicationsthatuseMicrosoftJettouseODBCDirectinstead.UsetheOpenConnectionmethodtoconnecttoanODBCdatasource.TheresultingConnectionobjectcontainsinformationabouttheconnection,suchastheservername,thedatasourcename,andsoon.

Queries

AlthoughDAOdoesnotsupportstoredqueresinanODBCDirectworkspace,acompiledquerycanbecreatedasaQueryDefobjectandusedtoexecuteactionqueries,andcanalsobeusedtoexecutestoredproceduresontheserver.ThePreparepropertyletsyoudecidewhethertocreateaprivate,temporarystoredprocedureontheserverfromaQueryDefbeforeactuallyexecutingthequery.

Parameterqueriescanalsobepassedtotheserver,usingParameterobjectsontheQueryDef.TheDirectionpropertyletsyouspecifyaParameterasinput,output,orboth,ortoacceptareturnvaluefromastoredprocedure.

DataManipulation

CreatingaRecordsetobjectisaconvenientwaytoqueryadatabaseandmanipulatetheresultingsetofrecords.TheOpenRecordsetmethodacceptsanSQLstring,oraQueryDefobject(storedquery)asadatasourceargument.TheresultingRecordsetobjectfeaturesanextremelyrichsetofpropertiesandmethodswithwhichtobrowseandmodifydata.

TheRecordsetobjectisavailableinfourdifferenttypes—Dynamic,

Page 15: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Dynaset,Forward-Only,andSnapshot—correspondingtoODBCcursortypes—Dynamic,Keyset,Forward-only,andStatic.

Abatchupdatecursorlibraryisavailableforclientapplicationsthatneedtoworkwithacursorwithoutholdinglocksontheserverorwithoutissuingupdaterequestsonerecordatatime.Instead,theclientstoresupdateinformationonmanyrecordsinalocalbuffer(or"batch"),andthenissuesabatchupdate.

AsynchronousMethodExecution

TheExecute,MoveLast,OpenConnection,andOpenRecordsetmethodsfeaturethedbRunAsyncoption.Thisallowsyourclientapplicationtodoothertasks(suchasloadingforms,forexample)whilethemethodisexecuting.YoucanchecktheStillExecutingpropertytoseewhetherthetaskiscomplete,andterminateanasynchronoustaskwiththeCancelmethod.

Page 16: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOConstants

DAOprovidesbuilt-inconstantsthatyoucanusewithmethodsorproperties.Theseconstantsallbeginwiththelettersdbandaredocumentedwiththemethodorpropertytowhichtheyapply.

Legend:

Read-only

Read/write

AllPermissionsPropertyConstants(AllAre )

ForanyContainerorDocumentobject:

Constant Description

dbSecReadDef Allowsusertoreadthetabledefinition,includingcolumnandindexinformation.

dbSecWriteDefAllowsusertomodifyordeletethetabledefinition,includingcolumnandindexinformation.

dbSecRetrieveData AllowsusertoretrievedatafromtheDocumentobject.

Page 17: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbSecInsertData Allowsusertoaddrecords.dbSecReplaceData Allowsusertomodifyrecords.dbSecDeleteData Allowsusertodeleterecords.

TheDatabasescontaineroranyDocumentobjectinaDocumentscollectionmayincludethefollowing:

Constant DescriptiondbSecDeleteData Allowsusertodeleterecords.

dbSecDBAdmin Allowsusertoreplicatethedatabaseandchangethedatabasepassword.

dbSecDBCreate

Allowsusertocreatenewdatabases.ThissettingisvalidonlyontheDatabasescontainerintheworkgroupinformationfile(System.mdw).

dbSecDBExclusive Allowsuserexclusiveaccesstothedatabase.dbSecDBOpen Allowsusertoopenthedatabase.

AttributesPropertyConstants

ForanyFieldobject,theAttributespropertymayincludethefollowing:

Constant Description

dbFixedField Fixedfieldsize(defaultforNumericfields)

dbVariableField Variablefieldsize(Textfieldsonly)

dbAutoIncrField

NewrecordfieldvalueincrementedtouniqueLonginteger(inaMicrosoftJetworkspace,availableonlyonTableDefobjectsopenedfrom.mdbfiles)

dbUpdatableField Fieldisupdatable

dbDescending Fieldsortedindescendingorder(MicrosoftJetworkspacesonly)

dbHyperlinkFieldThefieldcontainshyperlinkinformation

(MemofieldsinMicrosoftJetworkspacesonly)

dbSystemField

Thefieldisareplicationfield(onaTableDefobjectinMicrosoftJetdatabases

Page 18: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

only)

ForanyRelationobject,theAttributespropertymayincludethefollowing:

Constant DescriptiondbRelationUnique One-to-onerelationship

dbRelationDontEnforce Relationshipnotenforced(noreferentialintegrity)

dbRelationInherited Relationshipexistsinthedatabasecontainingthetwolinkedtables

dbRelationUpdateCascade UpdatescascadedbRelationDeleteCascade Deletionscascade

dbRelationLeftMicrosoftAccessonly.InDesignview,displayaLEFTJOINasthedefaultjointype.

dbRelationRightMicrosoftAccessonly.InDesignview,displayaRIGHTJOINasthedefaultjointype.

ForanyTableDefobject,theAttributespropertymayincludethefollowing:

Constant Description

dbAttachExclusive OpensalinkedMicrosoftJetdatabaseenginetableforexclusiveuse.

dbAttachSavePWD SavesuserIDandpasswordforlinkedremotetable.

dbSystemObject SystemtabledbHiddenObject Hiddentable(fortemporaryuse)dbAttachedTable Linkednon-ODBCdatabasetabledbAttachedODBC LinkedODBCdatabasetable

CollatingOrderPropertyConstants(AllAre )

Constant Description

Page 19: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbSortArabic ArabiccollatingorderdbSortChineseSimplified SimplifiedChinesecollatingorderdbSortChineseTraditional TraditionalChinesecollatingorderdbSortCyrillic RussiancollatingorderdbSortCzech CzechcollatingorderdbSortDutch Dutchcollatingorder

dbSortGeneral English,German,French,andPortuguesecollatingorder

dbSortGreek GreekcollatingorderdbSortHebrew HebrewcollatingorderdbSortHungarian HungariancollatingorderdbSortIcelandic IcelandiccollatingorderdbSortJapanese JapanesecollatingorderdbSortKorean KoreancollatingorderdbSortNeutral NeutralcollatingorderdbSortNorw NorwegianandDanishcollatingorderdbSortPDXIntl Paradoxinternationalcollatingorder

dbSortPDXNor ParadoxNorwegianandDanishcollatingorder

dbSortPDXSwe ParadoxSwedishandFinnishcollatingorder

dbSortPolish PolishcollatingorderdbSortSlovenian SloveniancollatingorderdbSortSpanish SpanishcollatingorderdbSortSwedFin SwedishandFinnishcollatingorderdbSortThai ThaicollatingorderdbSortTurkish TurkishcollatingorderdbSortUndefined Collatingorderundefinedorunknown

DefaultCursorDriverProperty(Allare )

Constant Description

dbUseDefaultCursor(Default)Usesserver-sidecursorsiftheserversupportsthem;otherwiseusestheODBCCursorLibrary.AlwaysusestheODBCCursorLibrary.Thisoptionprovidesbetterperformancefor

Page 20: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbUseODBCCursor smallresultsets,butdegradesquicklyforlargerresultsets.

dbUseServerCursor

Alwaysusesserver-sidecursors.Formostlargeoperationsthisoptionprovidesbetterperformance,butmightcausemorenetworktraffic.

dbUseClientBatchCursorAlwaysusestheFoxProCursorLibrary.Thisoptionisrequiredforperformingbatchupdates.

dbUseNoCursor

Opensallcursors(thatis,Recordsetobjects)asforward-onlytype,read-only,witharowsetsizeof1.Alsoknownas"cursorlessqueries."

DirectionPropertyConstants(AllAre )

Constant Description

dbParamInput (Default)Passesinformationtotheprocedure.

dbParamInputOutput Passesinformationbothtoandfromtheprocedure.

dbParamOutput ReturnsinformationfromtheprocedureasinanoutputparameterinSQL.

dbParamReturnValue Passesthereturnvaluefromaprocedure.

EditModePropertyConstants(AllAre )

Constant DescriptiondbEditNone Noeditingoperationineffect.dbEditInProgress Editmethodinvoked.dbEditAdd AddNewmethodinvoked.

PermissionsPropertyConstants(Allare )

ForanyContainerobject,thePermissionspropertymayincludethe

Page 21: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

following:

Constant DescriptiondbSecNoAccess Deniesuseraccesstotheobject.dbSecFullAccess Allowsuserfullaccesstotheobject.dbSecDelete Allowsusertodeletetheobject.

dbSecReadSec Allowsusertoreadtheobject'ssecurity-relatedinformation.

dbSecWriteSec Allowsusertoalteraccesspermissions.

dbSecWriteOwner AllowsusertochangetheOwnerpropertysetting.

ForanydatabaseContainer,thePermissionspropertymayincludeanyofthefollowing(Allare ):

Constant Description

dbSecDBAdminGivesuserpermissiontomakeadatabasereplicableandchangethedatabasepassword.

dbSecDBCreateAllowsusertocreatenewdatabases(validonlyonthedatabasesContainerobjectinthesystemdatabase).

dbSecDBOpen Allowsusertoopenthedatabase.dbSecDBExclusive Allowsuserexclusiveaccess.

ForanytablesContainer,thePermissionspropertymayincludeanyofthefollowing(Allare ):

Constant Description

dbSecCreate

Allowsusertocreatenewtables(validonlywithaContainerobjectthatrepresentsatableorwiththedatabasesContainerobjectinthesystemdatabase).

dbSecReadDef Allowsusertoreadthetabledefinition,includingcolumnandindexinformation.

dbSecWriteDefAllowsusertomodifyordeletethetabledefinition,includingcolumnandindex

Page 22: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

information.

dbSecRetrieveData Allowsusertoretrievedatafromthedocument.

dbSecInsertData Allowsusertoaddrecords.dbSecReplaceData Allowsusertomodifyrecords.dbSecDeleteData Allowsusertodeleterecords.

ForanyDocumentobject,thePermissionspropertymayincludeanyofthefollowing(Allare ):

Constant Description

dbSecCreateAllowsusertocreatenewtables(validonlywithaContainerobjectthatrepresentsatable).

dbSecDBCreateAllowsusertocreatenewdatabases(validonlyonthedatabasesContainerobjectinthesystemdatabase).

dbSecDBOpen Allowsusertoopenthedatabase.dbSecDBExclusive Allowsuserexclusiveaccess.dbSecDelete Allowsusertodeletetheobject.dbSecDeleteData Allowsusertodeleterecords.dbSecFullAccess Allowsuserfullaccesstotheobject.dbSecInsertData Allowsusertoaddrecords.

dbSecReadDef Allowsusertoreadthetabledefinition,includingcolumnandindexinformation.

dbSecReadSec Allowsusertoreadtheobject'ssecurity-relatedinformation.

dbSecReplaceData Allowsusertomodifyrecords.

dbSecRetrieveData Allowsusertoretrievedatafromthedocument.

dbSecWriteDefAllowsusertomodifyordeletethetabledefinition,includingcolumnandindexinformation.

dbSecWriteSec Allowsusertoalteraccesspermissions.

dbSecWriteOwner AllowsusertochangetheOwnerpropertysetting.

Page 23: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PreparePropertyConstants(AllAre )

Constant Description

dbQPrepare (Default)Thestatementisprepared(thatis,theODBCSQLPrepareAPIiscalled).

dbQUnprepare Thestatementisnotprepared(thatis,theODBCSQLExecDirectAPIiscalled).

RecordStatusPropertyConstants(AllAre )

Constant Description

dbDBDeleted Therecordhasbeendeletedlocallyandinthedatabase.

dbDeleted Therecordhasbeendeleted,butnotyetdeletedinthedatabase.

dbRecordModified Therecordhasbeenmodifiedandnotupdatedinthedatabase.

dbRecordNewTherecordhasbeeninsertedwiththeAddNewmethod,butnotyetinsertedintothedatabase.

dbRecordUnmodified (Default)Therecordhasnotbeenmodifiedorhasbeenupdatedsuccessfully.

TypePropertyConstants

ForanyField,Parameter,orPropertyobject,theTypepropertymayincludeanyofthefollwing(Allare ):

Constant DescriptiondbBigInt BigIntegerdata(ODBCDirectonly)dbBinary BinarydatadbBoolean Boolean(True/False)datadbByte Byte(8-bit)datadbChar Characterdata(ODBCDirectonly)dbCurrency CurrencydatadbDate DatevaluedatadbDecimal Decimaldata(ODBCDirectonly)

Page 24: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbDouble Double-precisionfloating-pointdatadbFloat Floating-pointdata(ODBCDirectonly)dbGUID GUIDdatadbInteger IntegerdatadbLong LongIntegerdatadbLongBinary Binarydata(bitmap)dbMemo Memodata(extendedtext)dbNumeric Numericdata(ODBCDirectonly)dbSingle Single-precisionfloating-pointdatadbText Textdata(variablewidth)dbTime Dataintimeformat(ODBCDirectonly)

dbTimeStamp Dataintimeanddateformat(ODBCDirectonly)

dbVarBinary VariableBinarydata(ODBCDirectonly)

ForanyQueryDefobject,theTypepropertymayincludeanyofthefollowing(Allare ):

Constant DescriptiondbQAction ActionquerydbQAppend Appendquery

dbQCompound Compoundquery(ODBCDirectworkspacesonly)

dbQCrosstab CrosstabquerydbQDDL Data-definitionlanguage(DDL)querydbQDelete DeletequerydbQMakeTable Make-tablequery

dbQProcedure SQLprocedurethatexecutesastoredprocedure(ODBCDirectworkspacesonly)

dbQSelect SelectquerydbQSetOperation SetoperationquerydbQSPTBulk BulkoperationquerydbQSQLPassThrough SQLpass-throughquerydbQUpdate Updatequery

ForanyRecordsetobject,theTypepropertymayincludeanyofthe

Page 25: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

following(Allare ):

Constants Description

dbOpenDynamic Opensadynaset-typeRecordset(ODBCDirectworkspacesonly)

dbOpenDynaset Opensadynaset-typeRecordsetdbOpenForwardOnly Opensaforward-onlytypeRecordsetdbOpenSnapshot Opensasnapshot-typeRecordset

dbOpenTable Opensatable-typeRecordset(MicrosoftJetworkspacesonly)

UpdateOptionsPropertyConstants(AllAre )

Constant Description

dbCriteriaKey (Default)Usesjustthekeycolumn(s)inthewhereclause.

dbCriteriaModValues Usesthekeycolumn(s)andallupdatedcolumnsinthewhereclause.

dbCriteriaAllCols Usesthekeycolumn(s)andallthecolumnsinthewhereclause.

dbCriteriaTimeStampUsesjustthetimestampcolumnifavailable(willgeneratearun-timeerrorifnotimestampcolumnisintheresultset).

dbCriteriaDeleteInsert UsesapairofDELETEandINSERTstatementsforeachmodifiedrow.

dbCriteriaUpdate (Default)UsesanUPDATEstatementforeachmodifiedrow.

CompactDatabase,CreateDatabaseMethodsLocaleArgumentConstants(AllAre )

Constant Description

dbLangGeneral English,German,French,Portuguese,Italian,andModernSpanish

dbLangArabic ArabicdbLangChineseSimplified SimplifiedChinesedbLangChineseTraditional TraditionalChinese

Page 26: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbLangCyrillic RussiandbLangCzech CzechdbLangDutch DutchdbLangGreek GreekdbLangHebrew HebrewdbLangHungarian HungariandbLangIcelandic IcelandicdbLangJapanese JapanesedbLangKorean KoreandbLangNordic NordicdbLangNorwDan NorwegianandDanishdbLangPolish PolishdbLangSlovenian SloveniandbLangSpanish SpanishdbLangSwedFin SwedishandFinnishdbLangThai ThaidbLangTurkish Turkish

CompactDatabaseMethodOptionsArgumentConstants(AllAre )

Constant DescriptiondbDecrypt DecryptsdatabasewhilecompactingdbEncrypt EncryptsdatabasedbVersion10 MicrosoftJetdatabaseengineversion1.0dbVersion11 MicrosoftJetdatabaseengineversion1.1dbVersion20 MicrosoftJetdatabaseengineversion2.0dbVersion30 MicrosoftJetdatabaseengineversion3.0

CreateDatabaseMethodOptionsArgumentConstants(AllAre )

Constant DescriptiondbEncrypt EncryptsdatabasedbVersion10 MicrosoftJetdatabaseengineversion1.0dbVersion11 MicrosoftJetdatabaseengineversion1.1dbVersion20 MicrosoftJetdatabaseengineversion2.0dbVersion30 MicrosoftJetdatabaseengineversion3.0

Page 27: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateWorkspaceMethodTypeArgumentConstants

ForanyWorkspaceobjectTypepropertyandDBEngineobjectDefaultTypeproperty,useanyofthefollowing:(AllAre )

Constant Description

dbUseODBC ThenextworkspacecreatedwilluseODBCDirect.

dbUseJet ThenextworkspacecreatedwillusetheMicrosoftJetdatabaseengine.

ExecuteMethodOptionsArgumentConstants(AllAre )

Constant Description

dbDenyWrite Denieswritepermissiontootherusers(MicrosoftJetworkspacesonly).

dbInconsistent Allowsinconsistentupdates(MicrosoftJetworkspacesonly).

dbConsistent Allowsconsistentupdates(MicrosoftJetworkspacesonly).

dbSQLPassThrough

AnSQLpass-through.CausestheSQLstatementtobepassedtoanODBCdatabaseforprocessing(MicrosoftJetworkspacesonly).

dbFailOnError Rollsbackupdatesifanerroroccurs(MicrosoftJetworkspacesonly).

dbSeeChangesGeneratesarun-timeerrorifanotheruserischangingdatayouareediting(MicrosoftJetworkspacesonly).

dbRunAsync Executesthequeryasynchronously(ODBCDirectworkspacesonly).

dbExecDirectExecutesthequerywithoutfirstcallingtheSQLPrepareODBCfunction(ODBCDirectworkspacesonly).

Page 28: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IdleMethodOptionalArgumentConstant(ThisIs )

Constant Description

dbRefreshCache Forcesanypendingwritestodisk,andrefreshesmemoryfromcurrentdiskfiles.

MakeReplicaMethodOptionalArgumentConstants(Allare )

Constant DescriptiondbRepMakePartial Createsapartialreplica.

dbRepMakeReadOnly Makesreplicableelementsofnewdatabaseread-only.

OpenConnectionandOpenDatabaseMethodsOptionArgumentConstants(AllAre )

Constant Description

dbDriverNoPrompt

Thedrivermanagerusestheconnectionstringprovidedinconnect.Ifsufficientinformationisnotprovided,atrappableerrorisreturned.

dbDriverPrompt

ThedrivermanagerdisplaystheODBCDataSourcesdialogbox.Theconnectionstringusedtoestablishtheconnectionisconstructedfromthedatasourcename(DSN)selectedandcompletedbytheuserviathedialogboxes.

dbDriverComplete

IftheconnectionstringprovidedincludestheDSNkeyword,thedrivermanagerusesthestringasprovidedinconnect,otherwiseitbehavesasitdoeswhendbDriverPromptisspecified.

dbDriverCompleteRequired

(Default)BehaveslikedbDriverCompleteexceptthedriverdisablesthecontrolsforanyinformationnotrequiredtocompletetheconnection.

Page 29: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

OpenRecordsetMethodTypeArgumentConstants(AllAre )

Constant Description

dbOpenDynamic Opensadynamic-typeRecordset(ODBCDirectworkspacesonly)

dbOpenDynaset Opensadynaset-typeRecordsetdbOpenForwardOnly Opensaforward-onlytypeRecordsetdbOpenSnapshot Opensasnapshot-typeRecordset

dbOpenTable Opensatable-typeRecordset(MicrosoftJetworkspacesonly)

OpenRecordsetMethodLockEditsArgumentConstants(AllAre )

Constant Description

dbPessimisticPessimisticconcurrency.Cursorusesthelowestleveloflockingsufficienttoensuretherecordcanbeupdated.

dbReadOnly Cursorisread-only.Noupdatesareallowed.

dbOptimistic

OptimisticconcurrencybasedonrecordID.CursorcomparesrecordIDinoldandnewrecordstodetermineifchangeshavebeenmadesincetherecordwaslastaccessed.

dbOptimisticValue

Optimisticconcurrencybasedonrecordvalues.Cursorcomparesdatavaluesinoldandnewrecordstodetermineifchangeshavebeenmadesincetherecordwaslastaccessed(ODBCDirectworkspacesonly).

dbOptimisticBatch Enablesbatchoptimisticupdates(ODBCDirectworkspacesonly).

OpenRecordsetMethodOptionsArgumentConstants(AllAre )

Constant Description

dbDenyWritePreventsotherusersfromchangingRecordsetrecords(MicrosoftJetworkspacesonly).

dbDenyReadPreventsotherusersfromreadingRecordsetrecords(table-typeinMicrosoft

Page 30: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Jetworkspacesonly).

dbReadOnly OpenstheRecordsetasread-only(MicrosoftJetworkspacesonly).

dbAppendOnly

Allowsusertoaddnewrecordstothedynaset,butpreventsuserfromreadingexistingrecords(dynaset-typeinMicrosoftJetworkspacesonly).

dbInconsistent

Appliesupdatestoalldynasetfields,evenifotherrecordsareaffected(dynaset-andsnapshot-typeinMicrosoftJetworkspacesonly).

dbConsistent

Appliesupdatesonlytothosefieldsthatwillnotaffectotherrecordsinthedynaset(dynaset-andsnapshot-typeinMicrosoftJetworkspacesonly).

dbSQLPassThroughSendsanSQLstatementtoanODBCdatabase(snapshot-typeinMicrosoftJetworkspacesonly).

dbForwardOnlyCreatesaforward-onlyscrollingsnapshot-typeRecordset(snapshot-typeinMicrosoftJetworkspacesonly).

dbSeeChangesGeneratesarun-timeerrorifanotheruserischangingdatayouareediting(dynaset-typeinMicrosoftJetworkspacesonly).

dbRunAsync Executesthequeryasynchronously(ODBCDirectworkspacesonly).

dbExecDirectExecutesthequerywithoutfirstcallingtheSQLPrepareODBCfunction(ODBCDirectworkspacesonly).

SetOptionMethodParameterConstants(AllAre )

Constant DescriptiondbPageTimeout ThePageTimeoutkeydbSharedAsyncDelay TheSharedAsyncDelaykeydbExclusiveAsyncDelay TheExclusiveAsyncDelaykeydbLockRetry TheLockRetrykeydbUserCommitSync TheUserCommitSynckeydbImplicitCommitSync TheImplicitCommitSynckey

Page 31: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbMaxBufferSize TheMaxBufferSizekeydbMaxLocksPerFile TheMaxLocksPerFilekeydbLockDelay TheLockDelaykeydbRecycleLVs TheRecycleLVskeydbFlushTransactionTimeout TheFlushTransactionTimeoutkey

SynchronizeMethodExchangeArgumentConstants(AllAre )

Constant Description

dbRepExportChanges Sendschangesfromcurrentdatabasetotargetdatabase.

dbRepImportChanges Receiveschangesfromtargetdatabase.

dbRepImpExpChanges Sendsandreceivesdatainabidirectionalexchange.

dbRepSyncInternet ExchangesdatabetweenfilesconnectedviaanInternetpathway.

UpdateMethodTypeArgumentConstants(AllAre )

Constant Description

dbUpdateRegular (Default)Pendingchangesaren'tcachedandarewrittentodiskimmediately.

dbUpdateBatch Allpendingchangesintheupdatecachearewrittentodisk.

dbUpdateCurrentRecord Onlythecurrentrecord'spendingchangesarewrittentodisk.

CancelUpdateMethodTypeArgumentConstants(AllAre )

Constant Description

dbUpdateRegular (Default)Pendingchangesaren'tcachedandarewrittentodiskimmediately.

dbUpdateBatch Allpendingchangesintheupdatecachearewrittentodisk.

Page 32: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOObjectsandCollectionsReference

DAOobjectsandcollectionsprovideaframeworkforusingcodetocreateandmanipulatecomponentsofyourdatabasesystem.Objectsandcollectionshavepropertiesthatdescribethecharacteristicsofdatabasecomponentsandmethodsthatyouusetomanipulatethem.Togethertheseobjectsandcollectionsformahierarchicalmodelofyourdatabasestructure,whichyoucancontrolprogrammatically.

Objectsandcollectionsprovidedifferenttypesofcontainmentrelations:Objectscontainzeroormorecollections,allofdifferenttypes;andcollectionscontainzeroormoreobjects,allofthesametype.Althoughobjectsandcollectionsaresimilarentities,thedistinctiondifferentiatesthetwotypesofrelations.

Inthefollowingtable,thetypeofcollectioninthefirstcolumncontainsthetypeofobjectinthesecondcolumn.Thethirdcolumndescribeswhateachtypeofobjectrepresents.

Collection Object Description

Connections Connection

InformationaboutaconnectiontoanODBCdatasource(ODBCDirectworkspacesonly)

Containers Container

Storageforinformationaboutapredefinedobjecttype(MicrosoftJetworkspacesonly)

Databases Database AnopendatabaseTheMicrosoftJetdatabase

Page 33: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

None DBEngine engine

Documents DocumentInformationaboutasaved,predefinedobject(MicrosoftJetworkspacesonly)

Errors Error Informationaboutanyerrorsassociatedwiththisobject

Fields FieldAcolumnthatispartofatable,query,index,relation,orrecordset

Groups GroupAgroupofuseraccounts(MicrosoftJetworkspacesonly)

Indexes Index

Predefinedorderinganduniquenessofvaluesinatable(MicrosoftJetworkspacesonly)

Parameters Parameter Aparameterforaparameterquery

Properties Property Abuilt-inoruser-definedproperty

QueryDefs QueryDef Asavedquerydefinition

Recordsets Recordset Therecordsinabasetableorquery

Relations Relation

Arelationshipbetweenfieldsintablesandqueries(MicrosoftJetworkspacesonly)

TableDefs TableDefAsavedtabledefinition(MicrosoftJetworkspacesonly)

Users User Auseraccount(MicrosoftJetworkspacesonly)

Workspaces Workspace AsessionoftheMicrosoftJetdatabaseengine

Page 34: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOObjectModelforMicrosoftJetWorkspaces

Page 35: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOObjectModelforODBCDirectWorkspaces

Page 36: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ConnectionObject

AConnectionobjectrepresentsaconnectiontoanODBCdatabase(ODBCDirectworkspacesonly).

Remarks

AConnectionisanon-persistentobjectthatrepresentsaconnectiontoaremotedatabase.TheConnectionobjectisonlyavailableinODBCDirectworkspaces(thatis,aWorkspaceobjectcreatedwiththetypeoptionsettodbUseODBC).

Page 37: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteCodewrittenforearlierversionsofDAOcancontinuetousetheDatabaseobjectforbackwardcompatibility,butifthenewfeaturesofaConnectionaredesired,youshouldrevisecodetousetheConnectionobject.Tohelpwithcodeconversion,youcanobtainaConnectionobjectreferencefromaDatabasebyreadingtheConnectionpropertyoftheDatabaseobject.Conversely,youcanobtainaDatabaseobjectreferencefromtheConnectionobject’sDatabaseproperty.

Page 38: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ConnectionsCollection

AConnectionscollectioncontainsthecurrentConnectionobjectsofaWorkspaceobject.(ODBCDirectworkspacesonly).

Remarks

WhenyouopenaConnectionobject,itisautomaticallyappendedtotheConnectionscollectionoftheWorkspace.WhenyoucloseaConnectionobjectwiththeClosemethod,itisremovedfromtheConnectionscollection.YoushouldcloseallopenRecordsetobjects

Page 39: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

withintheConnectionbeforeclosingit.

AtthesametimeyouopenaConnectionobject,acorrespondingDatabaseobjectiscreatedandappendedtotheDatabasescollectioninthesameWorkspace,andviceversa.Similarly,whenyouclosetheConnection,thecorrespondingDatabaseisdeletedfromtheDatabasescollection,andsoon.

TheNamepropertysettingofaConnectionisastringthatspecifiesthepathofthedatabasefile.TorefertoaConnectionobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Connections(0)

Connections("name")

Connections![name]

NoteYoucanopenthesamedatasourcemorethanonce,creatingduplicatenamesintheConnectionscollection.YoushouldassignConnectionobjectstoobjectvariablesandrefertothembyvariablename.

Page 40: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ConnectionObject,ConnectionsCollectionSummary

ConnectionObject

TheConnectionobjectcontainsthesecollections,methods,andproperties.

Collections

QueryDefs(default)Recordsets

Methods

CancelCloseCreateQueryDefExecuteOpenRecordset

Properties

ConnectDatabaseNameQueryTimeoutRecordsAffected

Page 41: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

StillExecutingTransactionsUpdatable

ConnectionsCollection

AConnectionscollectioniscontainedineachODBCDirectWorkspaceobject,andcontainsthismethodandthisproperty:

Method

Refresh

Property

Count

Page 42: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ContainersCollection

AContainerscollectioncontainsalloftheContainerobjectsthataredefinedinadatabase(MicrosoftJetdatabasesonly).

Remarks

EachDatabaseobjecthasaContainerscollectionconsistingofbuilt-inContainerobjects.SomeoftheseContainerobjectsaredefinedbytheMicrosoftJetdatabaseenginewhileothersmaybedefinedbyotherapplications.

Page 43: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ContainerObject

AContainerobjectgroupssimilartypesofDocumentobjectstogether.

Remarks

EachDatabaseobjecthasaContainerscollectionconsistingofbuilt-inContainerobjects.Applicationscandefinetheirowndocumenttypesandcorrespondingcontainers(MicrosoftJetdatabasesonly);however,theseobjectsmaynotalwaysbesupportedthroughDAO.

SomeoftheseContainerobjectsaredefinedbytheMicrosoftJet

Page 44: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

databaseenginewhileothersmaybedefinedbyotherapplications.ThefollowingtableliststhenameofeachContainerobjectdefinedbytheMicrosoftJetdatabaseengineandwhattypeofinformationitcontains.

Containername ContainsinformationaboutDatabases SaveddatabasesTables SavedtablesandqueriesRelations Savedrelationships

NoteDon'tconfusetheContainerobjectslistedintheprecedingtablewiththecollectionsofthesamename.TheDatabasesContainerobjectreferstoallsaveddatabaseobjects,buttheDatabasescollectionrefersonlytodatabaseobjectsthatareopeninaparticularworkspace.

EachContainerobjecthasaDocumentscollectioncontainingDocumentobjectsthatdescribeinstancesofbuilt-inobjectsofthetypespecifiedbytheContainer.YoutypicallyuseaContainerobjectasanintermediatelinktotheinformationintheDocumentobject.YoucanalsousetheContainerscollectiontosetsecurityforallDocumentobjectsofagiventype.

WithanexistingContainerobject,youcan:

UsetheNamepropertytoreturnthepredefinednameoftheContainerobject.

UsetheOwnerpropertytosetorreturntheowneroftheContainerobject.TosettheOwnerproperty,youmusthavewritepermissionfortheContainerobject,andyoumustsetthepropertytothenameofanexistingUserorGroupobject.

UsethePermissionsandUserNamepropertiestosetaccesspermissionsfortheContainerobject;anyDocumentobject

Page 45: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

createdintheDocumentscollectionofaContainerobjectinheritstheseaccesspermissionsettings.

BecauseContainerobjectsarebuilt-in,youcan'tcreatenewContainerobjectsordeleteexistingones.

TorefertoaContainerobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Containers(0)

Containers("name")

Containers![name]

Page 46: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ContainerObject,ContainersCollectionSummary

ContainerObject

AContainerobjectcontainsnomethods;itcontainsthesecollectionsandproperties.

Collections

Documents(Default)Properties

Properties

AllPermissionsInheritNameOwnerPermissionsUserName

ContainersCollection

AContainerscollectionappearsineachDatabaseobjectofaMicrosoftJetdatabase,andcontainsthismethodandthisproperty.

Method

Page 47: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Refresh

Property

Count

Page 48: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DatabasesCollection

ADatabasescollectioncontainsallopenDatabaseobjectsopenedorcreatedinaWorkspaceobject.

Remarks

WhenyouopenanexistingDatabaseobjectorcreateanewonefroma

Page 49: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Workspace,itisautomaticallyappendedtotheDatabasescollection.WhenyoucloseaDatabaseobjectwiththeClosemethod,itisremovedfromtheDatabasescollectionbutnotdeletedfromdisk.YoushouldcloseallopenRecordsetobjectsbeforeclosingaDatabaseobject.

InaMicrosoftJetworkspace,theNamepropertysettingofadatabaseisastringthatspecifiesthepathofthedatabasefile.InanODBCDirectworkspace,theNamepropertyisthenameofthecorrespondingConnectionobject.

TorefertoaDatabaseobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Databases(0)

Databases("name")

Databases![name]

NoteYoucanopenthesamedatasourceordatabasemorethanonce,creatingduplicatenamesintheDatabasescollection.YoushouldassignDatabaseobjectstoobjectvariablesandrefertothembyvariablename.

Page 50: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DatabaseObject

ADatabaseobjectrepresentsanopendatabase.

Remarks

YouusetheDatabaseobjectanditsmethodsandpropertiestomanipulateanopendatabase.Inanytypeofdatabase,youcan:

Page 51: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsetheExecutemethodtorunanactionquery.

SettheConnectpropertytoestablishaconnectiontoanODBCdatasource.

SettheQueryTimeoutpropertytolimitthelengthoftimetowaitforaquerytoexecuteagainstanODBCdatasource.

UsetheRecordsAffectedpropertytodeterminehowmanyrecordswerechangedbyanactionquery.

UsetheOpenRecordsetmethodtoexecuteaselectqueryandcreateaRecordsetobject.

UsetheVersionpropertytodeterminewhichversionofadatabaseenginecreatedthedatabase.

WithaMicrosoftJetdatabase(.mdbfile),youcanalsouseothermethods,properties,andcollectionstomanipulateaDatabaseobject,aswellascreate,modify,orgetinformationaboutitstables,queries,andrelationships.Forexample,youcan:

UsetheCreateTableDefandCreateRelationmethodstocreatetablesandrelations,respectively.

UsetheCreatePropertymethodtodefinenewDatabaseproperties.

UsetheCreateQueryDefmethodtocreateapersistentor

Page 52: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

temporaryquerydefinition.

UseMakeReplica,Synchronize,andPopulatePartialmethodstocreateandsynchronizefullorpartialreplicasofyourdatabase.

SettheCollatingOrderpropertytoestablishthealphabeticsortingorderforcharacter-basedfieldsindifferentlanguages.

InanODBCDirectworkspace,youcan:

UsetheConnectionpropertytoobtainareferencetotheConnectionobjectthatcorrespondstotheDatabaseobject.

NoteForacompletelistofallmethods,properties,andcollectionsavailableonaDatabaseobjectineitheraMicrosoftJetworkspaceorODBCDirectworkspace,seetheSummarytopic.

YouusetheCreateDatabasemethodtocreateapersistentDatabaseobjectthatisautomaticallyappendedtotheDatabasescollection,therebysavingittodisk.

Youdon'tneedtospecifytheDBEngineobjectwhenyouusetheOpenDatabasemethod.

Openingadatabasewithlinkedtablesdoesn'tautomaticallyestablishlinkstothespecifiedexternalfilesorMicrosoftJet-connectedODBCdatasources.Youmusteitherreferencethetable'sTableDeforFieldobjectsoropenaRecordsetobject.Ifyoucan'testablishlinkstothesetables,atrappableerroroccurs.Youmayalsoneedpermissiontoaccessthedatabase,oranotherusermighthavethedatabaseopenedexclusively.Inthesecases,trappableerrorsoccur.

YoucanalsousetheOpenDatabasemethodtoopenanexternaldatabase(suchasFoxPro,dBASE,andParadox)directlyinsteadofopeningaMicrosoftJetdatabasethathaslinkstoitstables.

Page 53: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteOpeningaDatabaseobjectdirectlyonaMicrosoftJet-connectedODBCdatasource,suchasMicrosoftSQLServer,isnotrecommendedbecausequeryperformanceismuchslowerthanwhenusinglinkedtables.However,performanceisnotaproblemwithopeningaDatabaseobjectdirectlyonanexternalISAMdatabasefile,suchasFoxPro,Paradox,andsoforth.

WhenaprocedurethatdeclaresaDatabaseobjecthasexecuted,localDatabaseobjectsareclosedalongwithanyopenRecordsetobjects.Anypendingupdatesarelostandanypendingtransactionsarerolledback,butnotrappableerroroccurs.YoushouldexplicitlycompleteanypendingtransactionsoreditsandcloseRecordsetobjectsandDatabaseobjectsbeforeexitingproceduresthatdeclaretheseobjectvariableslocally.

Whenyouuseoneofthetransactionmethods(BeginTrans,CommitTrans,orRollback)ontheWorkspaceobject,thesetransactionsapplytoalldatabasesopenedontheWorkspacefromwhichtheDatabaseobjectwasopened.Ifyouwanttouseindependenttransactions,youmustfirstopenanadditionalWorkspaceobject,andthenopenanotherDatabaseobjectinthatWorkspaceobject.

NoteYoucanopenthesamedatasourceordatabasemorethanonce,creatingduplicatenamesintheDatabasescollection.YoushouldassignDatabaseobjectstoobjectvariablesandrefertothembyvariablename.

Page 54: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DatabaseObject,DatabasesCollectionSummary

DatabaseObject

ADatabaseobjectcontainsthesecollections,methods,andproperties.

Legend:

FeatureavailableinMicrosoftJetworkspacesonly.

FeatureavailableinODBCDirectworkspacesonly.

Collections

ContainersPropertiesQueryDefsRecordsets(Defaultfor )RelationsTableDefs(Defaultfor )

Methods

CloseCreatePropertyCreateQueryDefCreateRelationCreateTableDefExecute

Page 55: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MakeReplicaNewPasswordOpenRecordsetPopulatePartialSynchronize

Properties

CollatingOrderConnectConnectionDesignMasterIDNameQueryTimeoutRecordsAffectedReplicable(user-defined)ReplicaIDUpdatableV1xNullBehaviorVersion

DatabasesCollection

ADatabasescollectionappearsineachWorkspaceobject,andcontainsthismethodandthisproperty.

Method

Refresh

Property

Count

Page 56: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DBEngineObject

TheDBEngineobjectisthetoplevelobjectintheDAOobjectmodel.

Remarks

TheDBEngineobjectcontainsandcontrolsallotherobjectsinthehierarchyofDAOobjects.Youcan'tcreateadditionalDBEngineobjects,andtheDBEngineobjectisn'tanelementofanycollection.

NoteWhenyoureferenceanODBCdatasourcedirectlythroughDAO,itiscalledan"ODBCDirectworkspace."ThisistodistinguishitfromanODBCdatasourcethatyoureferenceindirectlythroughthe

Page 57: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MicrosoftJetdatabaseengine,usinga"MicrosoftJetworkspace."EachmethodofaccessingODBCdatarequiresoneoftwotypesofWorkspaceobject;youcansettheDefaultTypepropertytochoosethedefaulttypeofWorkspaceobjectthatyouwillcreatefromtheDBEngineobject.TheWorkspacetypeandassociateddatasourcedetermineswhichDAOobjects,methods,andpropertiesyoucanuse.

Withanytypeofdatabaseorconnection,youcan:

UsetheVersionpropertytoobtaintheDAOversionnumber.

UsetheLoginTimeoutpropertytoobtainorsettheODBClogintimeout,andtheRegisterDatabasemethodtoprovideODBCinformationtotheMicrosoftJetdatabaseengine.Youcanusethesefeaturesthesameway,regardlessofwhetheryouconnecttotheODBCdatasourcethroughMicrosoftJetorthroughanODBCDirectworkspace.

UsetheDefaultTypepropertytosetthedefaulttypeofdatabaseconnectionthatsubsequentlycreatedWorkspaceobjectswilluse—eitherMicrosoftJetorODBCDirect.

UsetheDefaultPasswordandDefaultUserpropertiestosettheuseridentificationandpasswordforthedefaultWorkspaceobject.

UsetheCreateWorkspacemethodtocreateanewWorkspaceobject.YoucanuseoptionalargumentstooverridethesettingsoftheDefaultType,DefaultPassword,andDefaultUserproperties.

UsetheOpenDatabasemethodtoopenadatabaseinthedefault

Page 58: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Workspace,andusetheBeginTrans,Commit,andRollbackmethodstocontroltransactionsonthedefaultWorkspace.

UsetheWorkspacescollectiontoreferencespecificWorkspaceobjects.

UsetheErrorscollectiontoexaminedataaccesserrordetails.

OtherpropertiesandmethodsareonlyavailablewhenyouuseDAOwiththeMicrosoftJetdatabaseengine.YoucanusethemtocontroltheMicrosoftJetdatabaseengine,manipulateitsproperties,andperformtasksontemporaryobjectsthataren'telementsofcollections.Forexample,youcan:

UsetheCreateDatabasemethodtocreateanewMicrosoftJetDatabaseobject.

UsetheIdlemethodtoenabletheMicrosoftJetdatabaseenginetocompleteanypendingtasks.

UsetheCompactDatabaseandRepairDatabasemethodstomaintaindatabasefiles.

UsetheIniPathandSystemDBpropertiestospecifythelocationofMicrosoftJetWindowsRegistryinformationandtheMicrosoftJetworkgroupinformationfile,respectively.TheSetOptionmethodallowsyouoverridewindowsregistrysettingsfortheMicrosoftJetdatabaseengine.

AfteryouchangetheDefaultTypeandIniPathpropertysettings,onlysubsequentWorkspaceobjectswillreflectthesechanges.

Page 59: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteForacompletelistofallmethods,properties,andcollectionsavailableontheDBEngineobject,seetheSummarytopic.

TorefertoacollectionthatbelongstotheDBEngineobject,ortorefertoamethodorpropertythatappliestothisobject,usethissyntax:

[DBEngine.][collection|method|property]

Page 60: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DBEngineObjectSummary

TheDBEngineobjectcontainsthesecollections,methods,andproperties.

Legend:

FeatureavailableinMicrosoftJetworkspacesonly.

FeatureavailableinODBCDirectworkspacesonly.

Collections

ErrorsPropertiesWorkspaces(Default)

Methods

BeginTransCommitTransCompactDatabaseCreateDatabaseCreateWorkspaceIdleOpenConnectionOpenDatabaseRegisterDatabaseRepairDatabaseRollback

Page 61: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SetOption

Properties

DefaultPasswordDefaultTypeDefaultUserIniPathLoginTimeoutSystemDBVersion

Page 62: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DocumentsCollection

ADocumentscollectioncontainsalloftheDocumentobjectsforaspecifictypeofobject(MicrosoftJetdatabasesonly).

Remarks

EachContainerobjecthasaDocumentscollectioncontainingDocumentobjectsthatdescribeinstancesofbuilt-inobjectsofthetypespecifiedbytheContainer.

TorefertoaDocumentobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Page 63: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Documents(0)

Documents("name")

Documents![name]

Page 64: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DocumentObject

ADocumentobjectincludesinformationaboutoneinstanceofanobject.Theobjectcanbeadatabase,savedtable,query,orrelationship(MicrosoftJetdatabasesonly).

Remarks

EachContainerobjecthasaDocumentscollectioncontainingDocumentobjectsthatdescribeinstancesofbuilt-inobjectsofthetypespecifiedbytheContainer.ThefollowingtableliststhetypeofobjecteachDocumentdescribes,thenameofitsContainerobject,andwhattypeofinformationDocumentcontains.

Page 65: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Document Container ContainsinformationaboutDatabase Databases SaveddatabaseTableorquery Tables SavedtableorqueryRelationship Relations Savedrelationship

NoteDon'tconfusetheContainerobjectslistedintheprecedingtablewiththecollectionsofthesamename.TheDatabasesContainerobjectreferstoallsaveddatabaseobjects,buttheDatabasescollectionrefersonlytodatabaseobjectsthatareopeninaparticularworkspace.

WithaDocumentobject,youcan:

UsetheNamepropertytoreturnthenamethatauserortheMicrosoftJetdatabaseenginegavetotheobjectwhenitwascreated.

UsetheContainerpropertytoreturnthenameoftheContainerobjectthatcontainstheDocumentobject.

UsetheOwnerpropertytosetorreturntheowneroftheobject.TosettheOwnerproperty,youmusthavewritepermissionfortheDocumentobject,andyoumustsetthepropertytothenameofanexistingUserorGroupobject.

UsetheUserNameorPermissionspropertiestosetorreturntheaccesspermissionsofauserorgroupfortheobject.Tosettheseproperties,youmusthavewritepermissionfortheDocumentobject,andyoumustsettheUserNamepropertytothenameofanexistingUserorGroupobject.

Page 66: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsetheDateCreatedandLastUpdatedpropertiestoreturnthedateandtimewhentheDocumentobjectwascreatedandlastmodified.

BecauseaDocumentobjectcorrespondstoanexistingobject,youcan'tcreatenewDocumentobjectsordeleteexistingones.TorefertoaDocumentobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Documents(0)

Documents("name")

Documents![name]

Page 67: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DocumentObject,DocumentsCollectionSummary

DocumentObject

ADocumentobjectcontainsthiscollection,thismethod,andtheseproperties.

Collection

Properties

Method

CreateProperty

Properties

AllPermissionsContainerDateCreatedKeepLocal(user-defined)LastUpdatedNameOwnerPermissionsReplicable(user-defined)UserName

Page 68: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DocumentsCollection

ADocumentscollectionappearsineachContainerobject,andcontainsthismethodandthisproperty.

Method

Refresh

Property

Count

Page 69: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Dynamic-TypeRecordsetObject

ThisRecordsettyperepresentsaqueryresultsetfromoneormorebasetablesinwhichyoucanadd,change,ordeleterecordsfromarow-returningquery.Further,recordsthatotherusersadd,delete,oreditinthebasetablesalsoappearinyourRecordset.

ThistypeisonlyavailableinODBCDirectworkspaces,andcorrespondstoanODBCdynamiccursor.

Page 70: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Dynaset-TypeRecordsetObjectSummary

Thedynaset-typeRecordsetobjectcontainsthesecollections,methods,andproperties.

Legend:

FeatureavailableinMicrosoftJetworkspacesonly.

FeatureavailableinODBCDirectworkspacesonly.

Collections

Fields(default)PropertiesMethods RestrictionsAddNewCancelCancelUpdateCloneCloseCopyQueryDefDeleteEditFillCacheFindFirstFindLastFindNextFindPreviousGetRows

Page 71: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MoveMoveFirstMoveLastMoveNextMovePreviousNextRecordsetOpenRecordsetRequeryUpdate

Properties

Thefollowingtableindicateswhetherthepropertysettingisread/write,read-only,oronlyavailableineitherMicrosoftJetorODBCDirectworkspaces.

Read-only

Read/write

Properties RestrictionsAbsolutePositionBatchCollisionCountBatchCollisionsBatchSizeBOFBookmarkBookmarkable

CacheSizeMicrosoftJet

ODBCDirect

CacheStartConnectionEditModeEOFFilter

Page 72: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

LastModified

LockEdits

NameNoMatchPercentPositionRecordCountRecordStatusRestartableSortStillExecutingTransactionsTypeUpdatableUpdateOptionsValidationRuleValidationText

Page 73: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ErrorsCollection

AnErrorscollectioncontainsallstoredErrorobjects,eachofwhichpertainstoasingleoperationinvolvingDAO.

Remarks

AnyoperationinvolvingDAOobjectscangenerateoneormoreerrors.Aseacherroroccurs,oneormoreErrorobjectsareplacedintheErrorscollectionoftheDBEngineobject.WhenanotherDAOoperationgeneratesanerror,theErrorscollectioniscleared,andthenewsetofErrorobjectsisplacedintheErrorscollection.Thehighest-numberedobjectintheErrorscollection(DBEngine.Errors.Count-1)

Page 74: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

correspondstotheerrorreportedbytheMicrosoftVisualBasicforApplications(VBA)Errobject.

DAOoperationsthatdon'tgenerateanerrorhavenoeffectontheErrorscollection.

ElementsoftheErrorscollectionaren'tappendedastheytypicallyarewithothercollections,sotheErrorscollectiondoesn'tsupporttheAppendandDeletemethods.

ThesetofErrorobjectsintheErrorscollectiondescribesoneerror.ThefirstErrorobjectisthelowestlevelerror,thesecondthenexthigherlevel,andsoforth.Forexample,ifanODBCerroroccurswhiletryingtoopenaRecordsetobject,thefirsterrorobjectcontainsthelowestlevelODBCerror;subsequenterrorscontaintheODBCerrorsreturnedbythevariouslayersofODBC.Inthiscase,theODBCdrivermanager,andpossiblythedriveritself,returnseparateErrorobjects.ThelastErrorobjectcontainstheDAOerrorindicatingthattheobjectcouldn'tbeopened.

EnumeratingthespecificerrorsintheErrorscollectionenablesyourerror-handlingroutinestomorepreciselydeterminethecauseandoriginofanerror,andtakeappropriatestepstorecover.

NoteIfyouusetheNewkeywordtocreateanobjectthatcausesanerroreitherbeforeorwhilebeingplacedintotheErrorscollection,thecollectiondoesn'tcontainerrorinformationaboutthatobject,becausethenewobjectisnotassociatedwiththeDBEngineobject.However,theerrorinformationisavailableintheVBAErrobject.

Page 75: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ErrorObject

AnErrorobjectcontainsdetailsaboutdataaccesserrors,eachofwhichpertainstoasingleoperationinvolvingDAO.

Remarks

AnyoperationinvolvingDAOcangenerateoneormoreerrors.Forexample,acalltoanODBCservermightresultinanerrorfromthedatabaseserver,anerrorfromODBC,andaDAOerror.Aseachsucherroroccurs,anErrorobjectisplacedintheErrorscollectionoftheDBEngineobject.AsingleeventcanthereforeresultinseveralErrorobjectsappearingintheErrorscollection.

Page 76: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

WhenasubsequentDAOoperationgeneratesanerror,theErrorscollectioniscleared,andoneormorenewErrorobjectsareplacedintheErrorscollection.DAOoperationsthatdon'tgenerateanerrorhavenoeffectontheErrorscollection.

ThesetofErrorobjectsintheErrorscollectiondescribesoneerror.ThefirstErrorobjectisthelowestlevelerror(theoriginatingerror),thesecondthenexthigherlevelerror,andsoforth.Forexample,ifanODBCerroroccurswhiletryingtoopenaRecordsetobject,thefirstErrorobject—Errors(0)—containsthelowestlevelODBCerror;subsequenterrorscontaintheODBCerrorsreturnedbythevariouslayersofODBC.Inthiscase,theODBCdrivermanager,andpossiblythedriveritself,returnseparateErrorobjects.ThelastErrorobject—Errors.Count-1—containstheDAOerrorindicatingthattheobjectcouldn'tbeopened.

EnumeratingthespecificerrorsintheErrorscollectionenablesyourerror-handlingroutinestomorepreciselydeterminethecauseandoriginofanerror,andtakeappropriatestepstorecover.OnbothMicrosoftJetandODBCDirectworkspaces,youcanreadtheErrorobject’spropertiestoobtainspecificdetailsabouteacherror,including:

TheDescriptionproperty,whichcontainsthetextoftheerroralertthatwillbedisplayedonthescreeniftheerrorisnottrapped.

TheNumberproperty,whichcontainstheLongintegervalueoftheerrorconstant.

TheSourceproperty,whichidentifiestheobjectthatraisedtheerror.ThisisparticularlyusefulwhenyouhaveseveralErrorobjectsintheErrorscollectionfollowingarequesttoanODBCdatasource.

TheHelpFileandHelpContextproperties,whichindicatethe

Page 77: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

appropriateMicrosoftWindowsHelpfileandHelptopic,respectively,(ifanyexist)fortheerror.

NoteWhenprogramminginMicrosoftVisualBasicforApplications(VBA),ifyouusetheNewkeywordtocreateanobjectthatsubsequentlycausesanerrorbeforethatobjecthasbeenappendedtoacollection,theDBEngineobject'sErrorscollectionwon'tcontainanentryforthatobject'serror,becausethenewobjectisnotassociatedwiththeDBEngineobject.However,theerrorinformationisavailableintheVBAErrobject.

YourVBAerror-handlingcodeshouldexaminetheErrorscollectionwheneveryouanticipateadataaccesserror.Ifyouarewritingacentralizederrorhandler,testtheVBAErrobjecttodetermineiftheerrorinformationintheErrorscollectionisvalid.IftheNumberpropertyofthelastelementoftheErrorscollection(DBEngine.Errors.Count-1)andthevalueoftheErrobjectmatch,youcanthenuseaseriesofSelectCasestatementstoidentifytheparticularDAOerrororerrorsthatoccurred.Iftheydonotmatch,usetheRefreshmethodontheErrorscollection.

Page 78: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ErrorObject,ErrorsCollectionSummary

ErrorObject

AnErrorobjectcontainsnomethods;nocollections,andtheseproperties:

Properties

DescriptionHelpContextHelpFileNumberSource

ErrorsCollection

AnErrorscollectionappearsintheDBEngineobject,andcontainsthismethodandthisproperty:

Method

Refresh

Property

Count

Page 79: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

FieldsCollection

AFieldscollectioncontainsallstoredFieldobjectsofanIndex,QueryDef(MicrosoftJetworkspacesonly),Recordset,Relation,orTableDefobject.

Remarks

TheFieldscollectionsoftheIndex,QueryDef,Relation,andTableDef

Page 80: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

objectscontainthespecificationsforthefieldsthoseobjectsrepresent.TheFieldscollectionofaRecordsetobjectrepresentstheFieldobjectsinarowofdata,orinarecord.YouusetheFieldobjectsinaRecordsetobjecttoreadandtosetvaluesforthefieldsinthecurrentrecordoftheRecordsetobject.

TorefertoaFieldobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Fields(0)

Fields("name")

Fields![name]

Withthesamesyntaxforms,youcanalsorefertotheValuepropertyofaFieldobjectthatyoucreateandappendtoaFieldscollection.ThecontextofthefieldreferencewilldeterminewhetheryouarereferringtotheFieldobjectortheValuepropertyoftheFieldobject.

Page 81: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

FieldObject

AFieldobjectrepresentsacolumnofdatawithacommondatatypeandacommonsetofproperties.

Remarks

TheFieldscollectionsofIndex,QueryDef,Relation,andTableDefobjectscontainthespecificationsforthefieldsthoseobjectsrepresent.

Page 82: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TheFieldscollectionofaRecordsetobjectrepresentstheFieldobjectsinarowofdata,orinarecord.YouusetheFieldobjectsinaRecordsetobjecttoreadandsetvaluesforthefieldsinthecurrentrecordoftheRecordsetobject.

InbothMicrosoftJetandODBCDirectworkspaces,youmanipulateafieldusingaFieldobjectanditsmethodsandproperties.Forexample,youcan:

UsetheOrdinalPositionpropertytosetorreturnthepresentationorderoftheFieldobjectinaFieldscollection.(Thispropertyisread-onlyforODBCDirectdatabases.)

UsetheValuepropertyofafieldinaRecordsetobjecttosetorreturnstoreddata.

UsetheAppendChunkandGetChunkmethodsandtheFieldSizepropertytogetorsetavalueinanOLEObjectorMemofieldofaRecordsetobject.

UsetheType,Size,andAttributespropertiestodeterminethetypeofdatathatcanbestoredinthefield.

UsetheSourceFieldandSourceTablepropertiestodeterminetheoriginalsourceofthedata.

InMicrosoftJetworkspaces,youcan:

UsetheForeignNamepropertytosetorreturninformationaboutaforeignfieldinaRelationobject.

Page 83: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsetheAllowZeroLength,DefaultValue,Required,ValidateOnSet,ValidationRule,orValidationTextpropertiestosetorreturnvalidationconditions.

UsetheDefaultValuepropertyofafieldonaTableDefobjecttosetthedefaultvalueforthisfieldwhennewrecordsareadded.

InODBCDirectworkspaces,youcan:

UsetheValue,VisibleValue,andOriginalValuepropertiestoverifysuccessfulcompletionofabatchupdate.

NoteForacompletelistofallmethods,properties,andcollectionsavailableonaFieldobjectinanydatabaseorconnection,seetheSummarytopic.

TocreateanewFieldobjectinanIndex,TableDef,orRelationobject,usetheCreateFieldmethod.

WhenyouaccessaFieldobjectaspartofaRecordsetobject,datafromthecurrentrecordisvisibleintheFieldobject'sValueproperty.TomanipulatedataintheRecordsetobject,youdon'tusuallyreferencetheFieldscollectiondirectly;instead,youindirectlyreferencetheValuepropertyoftheFieldobjectintheFieldscollectionoftheRecordsetobject.

TorefertoaFieldobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Fields(0)

Fields("name")

Fields![name]

Withthesamesyntaxforms,youcanalsorefertotheValuepropertyofaFieldobjectthatyoucreateandappendtoaFieldscollection.The

Page 84: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

contextofthefieldreferencewilldeterminewhetheryouarereferringtotheFieldobjectortheValuepropertyoftheFieldobject.

Page 85: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

FieldObject,FieldsCollectionSummary

FieldObject

AFieldobjectcontainsthiscollection,thesemethods,andtheseproperties.

Legend:

FeatureavailableinMicrosoftJetworkspacesonly.

FeatureavailableinODBCDirectworkspacesonly.

Collection

Properties

Methods

ThefollowingtablelistsalloftheFieldobjectmethods.ThetypeofobjectwhoseFieldscollectioncontainstheFieldobjectdetermineswhichmethodsareavailable.

Method Index QueryDef Recordset Relation TableDefAppendChunkCreatePropertyGetChunk

Properties

Page 86: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ThefollowingtablelistsalloftheFieldobjectproperties.ThetypeofobjectwhoseFieldscollectioncontainstheFieldobjectdetermineswhichpropertiesareavailable.Allpropertiesareread-onlyforFieldobjectsappendedtoFieldscollectionsofIndex,Relation,andTableDefobjects.

Read-only

Read/write

Property Index QueryDef Recordset Relation TableDefAllowZeroLength AttributesCollatingOrderDataUpdatableDefaultValueFieldSizeForeignNameNameOrdinalPositionOriginalValue *RequiredSizeSourceFieldSourceTableTypeValidateOnSetValidationRuleValidationTextValueVisibleValue *

*ThesepropertiesareonlyavailableinanODBCDirectworkspacewhoseDefaultCursorDriverpropertyissettodbUseClientBatchCursor.

FieldsCollection

Page 87: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AFieldscollectionappearsineachoftheTableDef,QueryDef,Recordset,Relation,andIndexobjects,andcontainsthesemethodsandthisproperty.

Method Index QueryDefRecordset Relation TableDefAppendDeleteRefresh

Property Index QueryDefRecordset Relation TableDefCount

Page 88: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Forward-Only–TypeRecordsetObject

ThisRecordsettypeisidenticaltoasnapshotexceptthatyoucanonlyscrollforwardthroughitsrecords.Thisimprovesperformanceinsituationswhereyouonlyneedtomakeasinglepassthrougharesultset.

InanODBCDirectworkspace,thistypecorrespondstoanODBCforward-onlycursor.

Page 89: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Forward-Only–TypeRecordsetObjectSummary

Theforward-onlytypeRecordsetobjectcontainsthesecollections,methods,andproperties.

Legend:

FeatureavailableinMicrosoftJetworkspacesonly.

FeatureavailableinODBCDirectworkspacesonly.

Collections

Fields(default)PropertiesMethods RestrictionsAddNewCancelCancelUpdateCloseCopyQueryDefDeleteEditGetRows

Move Onlywithforwardmovesthatdon'tuseabookmarkoffset.

MoveNextNextRecordsetRequeryUpdate

Page 90: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Properties

Thefollowingtableindicateswhethereachpropertysettingisread/write,read-only,oralwaysFalseineitherMicrosoftJetorODBCDirectworkspaces.

Read-only

Read/write

Properties RestrictionsBatchCollisionCountBatchCollisionsBatchSizeBOFConnectionEOFFilterNameRecordCountRecordStatusRestartableStillExecutingTransactions AlwaysFalseTypeUpdatable FalseUpdateOptionsValidationRuleValidationText

Page 91: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

GroupsCollection

AGroupscollectioncontainsallstoredGroupobjectsofaWorkspaceoruseraccount(MicrosoftJetworkspacesonly).

Remarks

YoucanappendanexistingGroupobjecttotheGroupscollectioninaUserobjecttoestablishmembershipofauseraccountinthatGroupobject.Alternatively,youcanappendaUserobjecttotheUserscollectioninaGroupobjecttogiveauseraccounttheglobal

Page 92: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

permissionsofthatgroup.Ineithercase,theexistingGroupobjectmustalreadybeamemberoftheGroupscollectionofthecurrentWorkspaceobject.IfyouuseaGroupsorUserscollectionotherthantheonetowhichyoujustappendedanobject,youmayneedtousetheRefreshmethodtorefreshthecollectionwithcurrentinformationfromthedatabase.

TorefertoaGroupobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Groups(0)

Groups("name")

Groups![name]

Page 93: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

GroupObject

AGroupobjectrepresentsagroupofuseraccountsthathavecommonaccesspermissionswhenaWorkspaceobjectoperatesasasecureworkgroup.(MicrosoftJetworkspacesonly).

Remarks

YoucreateGroupobjectsandthenusetheirnamestoestablishandenforceaccesspermissionsforyourdatabases,tables,andqueriesusingtheDocumentobjectsthatrepresenttheDatabase,TableDef,and

Page 94: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

QueryDefobjectswithwhichyou'reworking.

WiththepropertiesofaGroupobject,youcan:

UsetheNamepropertyofanexistingGroupobjecttoreturnitsname.Youcan'treturnthePIDpropertysettingofanexistingGroupobject.

UsetheNameandPIDpropertiesofanewlycreated,unappendedGroupobjecttosettheidentityofthatGroupobject.

YoucanappendanexistingGroupobjecttotheGroupscollectioninaUserobjecttoestablishmembershipofauseraccountinthatGroupobject.Alternatively,youcanappendaUserobjecttotheUserscollectioninaGroupobjecttogiveauseraccounttheglobalpermissionsofthatgroup.IfyouuseaGroupsorUserscollectionotherthantheonetowhichyoujustappendedanobject,youmayneedtousetheRefreshmethodtorefreshthecollectionwithcurrentinformationfromthedatabase.

TheMicrosoftJetdatabaseenginepredefinesthreeGroupobjectsnamedAdmins,Users,andGuests.TocreateanewGroupobject,usetheCreateGroupmethodonaUserorWorkspaceobject.

TorefertoaGroupobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Groups(0)

Groups("name")

Groups![name]

Page 95: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

GroupObject,GroupsCollectionSummary

GroupObject

AGroupobjectcontainsthesecollections,thismethod,andtheseproperties.

Collections

PropertiesUsers(default)

Method

CreateUser

Properties

NamePID

GroupsCollection

AGroupscollectionappearsineachUserandMicrosoftJetWorkspaceobject,andcontainsthesemethodsandthisproperty.

Methods

Page 96: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AppendDeleteRefresh

Property

Count

Page 97: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IndexesCollection

AnIndexescollectioncontainsallthestoredIndexobjectsofaTableDefobject(MicrosoftJetworkspacesonly).

Remarks

Whenyouaccessatable-typeRecordsetobject,usetheobject'sIndexpropertytospecifytheorderofrecords.SetthispropertytotheNamepropertysettingofanexistingIndexobjectintheIndexescollectionofthetheTableDefobjectunderlyingtheRecordsetobject.

Page 98: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteYoucanusetheAppendorDeletemethodonanIndexescollectiononlyiftheUpdatablepropertysettingofthecontainingTableDefobjectisTrue.

AfteryoucreateanewIndexobject,youshouldusetheAppendmethodtoaddittotheTableDefobject'sIndexescollection.

ImportantMakesureyourdatacomplieswiththeattributesofyournewindex.Ifyourindexrequiresuniquevalues,makesurethattherearenoduplicatesinexistingdatarecords.Ifduplicatesexist,theMicrosoftJetdatabaseenginecan'tcreatetheindex;atrappableerrorresultswhenyouattempttousetheAppendmethodonthenewindex.

Page 99: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IndexObject

Indexobjectsspecifytheorderofrecordsaccessedfromdatabasetablesandwhetherornotduplicaterecordsareaccepted,providingefficientaccesstodata.Forexternaldatabases,Indexobjectsdescribetheindexesestablishedforexternaltables(MicrosoftJetworkspacesonly).

Remarks

TheMicrosoftJetdatabaseengineusesindexeswhenitjoinstablesandcreatesRecordsetobjects.Indexesdeterminetheorderinwhichtable-

Page 100: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

typeRecordsetobjectsreturnrecords,buttheydon'tdeterminetheorderinwhichtheMicrosoftJetdatabaseenginestoresrecordsinthebasetableortheorderinwhichanyothertypeofRecordsetobjectreturnsrecords.

WithanIndexobject,youcan:

UsetheRequiredpropertytodeterminewhethertheFieldobjectsintheindexrequirevaluesthatarenotNull,andthenusetheIgnoreNullspropertytodeterminewhethertheNullvalueshaveindexentries.

UsethePrimaryandUniquepropertiestodeterminetheorderinganduniquenessoftheIndexobject.

TheMicrosoftJetdatabaseenginemaintainsallbasetableindexesautomatically.Itupdatesindexeswheneveryouadd,change,ordeleterecordsfromthebasetable.Onceyoucreatethedatabase,usetheCompactDatabasemethodperiodicallytobringindexstatisticsup-to-date.

Whenaccessingatable-typeRecordsetobject,youspecifytheorderofrecordsusingtheobject'sIndexproperty.SetthispropertytotheNamepropertysettingofanexistingIndexobjectintheIndexescollection.ThiscollectioniscontainedbytheTableDefobjectunderlyingtheRecordsetobjectthatyou'repopulating.

NoteYoudon'thavetocreateindexesforatable,butforlarge,unindexedtables,accessingaspecificrecordorprocessingjoinscantakealongtime.Conversely,havingtoomanyindexescanslowdownupdatestothedatabaseaseachofthetableindexesisamended.

TheAttributespropertyofeachFieldobjectintheindexdeterminestheorderofrecordsreturnedandconsequentlydetermineswhichaccesstechniquestouseforthatindex.

Page 101: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

EachFieldobjectintheFieldscollectionofanIndexobjectisacomponentoftheindex.TodefineanewIndexobject,setitspropertiesbeforeyouappendittoacollection,makingtheIndexobjectavailableforsubsequentuse.

NoteYoucanmodifytheNamepropertysettingofanexistingIndexobjectonlyiftheUpdatablepropertysettingofthecontainingTableDefobjectisTrue.

Whenyousetaprimarykeyforatable,theMicrosoftJetdatabaseengineautomaticallydefinesitastheprimaryindex.Aprimaryindexconsistsofoneormorefieldsthatuniquelyidentifyallrecordsinatableinapredefinedorder.Becausetheprimaryindexfieldmustbeunique,theMicrosoftJetdatabaseengineautomaticallysetstheUniquepropertyoftheprimaryIndexobjecttoTrue.Iftheprimaryindexconsistsofmorethanonefield,eachfieldcancontainduplicatevalues,butthecombinationofvaluesfromalltheindexedfieldsmustbeunique.Aprimaryindexconsistsofakeyforthetableandisalwaysmadeupofthesamefieldsastheprimarykey.

ImportantMakesureyourdatacomplieswiththeattributesofyournewindex.Ifyourindexrequiresuniquevalues,makesurethattherearenoduplicatesinexistingdatarecords.Ifduplicatesexist,theMicrosoftJetdatabaseenginecan'tcreatetheindex;atrappableerrorresultswhenyouattempttousetheAppendmethodonthenewindex.

Whenyoucreatearelationshipthatenforcesreferentialintegrity,theMicrosoftJetdatabaseengineautomaticallycreatesanindexwiththeForeignproperty,setastheforeignkeyinthereferencingtable.Afteryou'veestablishedatablerelationship,theMicrosoftJetdatabaseenginepreventsadditionsorchangestothedatabasethatviolatethatrelationship.IfyousettheAttributespropertyoftheRelationobjecttoallowcascadingupdatesandcascadingdeletes,theMicrosoftJetdatabaseengineupdatesordeletesrecordsinrelatedtablesautomatically.

Page 102: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TocreateanewIndexobject

1. UsetheCreateIndexmethodonaTableDefobject.

2. UsetheCreateFieldmethodontheIndexobjecttocreateaFieldobjectforeachfield(column)tobeincludedintheIndexobject.

3. SetIndexpropertiesasneeded.

4. AppendtheFieldobjecttotheFieldscollection.

5. AppendtheIndexobjecttotheIndexescollection.

NoteTheClusteredpropertyisignoredfordatabasesthatusetheMicrosoftJetdatabaseengine,whichdoesn'tsupportclusteredindexes.

Page 103: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IndexObject,IndexesCollectionSummary

IndexObject

AnIndexobjectcontainsthesecollections,methods,andproperties.

Collections

Fields(default)Properties

Methods

CreateFieldCreateProperty

Properties

ClusteredDistinctCountForeignIgnoreNullsNamePrimaryRequiredUnique

IndexesCollection

Page 104: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AnIndexescollectionappearsineachTableDefobject,andcontainsthesemethodsandthisproperty.

Methods

AppendDeleteRefresh

Property

Count

Page 105: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ParametersCollection

AParameterscollectioncontainsalltheParameterobjectsofaQueryDefobject.

Remarks

TheParameterscollectionprovidesinformationonlyaboutexistingparameters.Youcan'tappendobjectstoordeleteobjectsfromtheParameterscollection.

Page 106: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ParameterObject

AParameterobjectrepresentsavaluesuppliedtoaquery.TheparameterisassociatedwithaQueryDefobjectcreatedfromaparameterquery.

Remarks

ParameterobjectsallowyoutochangetheargumentsinafrequentlyrunQueryDefobjectwithouthavingtorecompilethequery.

UsingthepropertiesofaParameterobject,youcansetaqueryparameterthatcanbechangedbeforethequeryisrun.Youcan:

Page 107: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsetheNamepropertytoreturnthenameofaparameter.

UsetheValuepropertytosetorreturntheparametervaluestobeusedinthequery.

UsetheTypepropertytoreturnthedatatypeoftheParameterobject.

UsetheDirectionpropertytosetorreturnwhethertheparameterisaninputparameter,anoutputparameter,orboth.

InanODBCDirectworkspace,youcanalso:

ChangethesettingoftheTypeproperty.DoingsowillalsocleartheValueproperty.

UsetheDirectionpropertytosetorreturnwhethertheparameterisaninputparameter,anoutputparameter,orboth.

Page 108: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ParameterObject,ParametersCollectionSummary

ParameterObject

AParameterobjectcontainsnomethods;itcontainsthiscollectionandtheseproperties.

Legend:

FeatureavailableinODBCDirectworkspacesonly.

Collection

Properties

Properties

DirectionNameTypeValue(Default)

ParametersCollection

AParameterscollectionappearsineachQueryDefobjectandcontainsthismethodandthisproperty.

Method

Page 109: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Refresh

Property

Count

Page 110: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PropertiesCollection

APropertiescollectioncontainsallthePropertyobjectsforaspecificinstanceofanobject.

Remarks

EveryDAOobjectexcepttheConnectionandErrorobjectscontainsaPropertiescollection,whichhascertainbuilt-inPropertyobjects.ThesePropertyobjects(whichareoftenjustcalledproperties)uniquelycharacterizethatinstanceoftheobject.

Inadditiontothebuilt-inproperties,youcanalsocreateandaddyour

Page 111: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ownuser-definedproperties.Toaddauser-definedpropertytoanexistinginstanceofanobject,firstdefineitscharacteristicswiththeCreatePropertymethod,thenaddittothecollectionwiththeAppendmethod.Referencingauser-definedPropertyobjectthathasnotyetbeenappendedtoaPropertiescollectionwillcauseanerror,aswillappendingauser-definedPropertyobjecttoaPropertiescollectioncontainingaPropertyobjectofthesamename.

YoucanusetheDeletemethodtoremoveuser-definedpropertiesfromthePropertiescollection,butyoucan'tremovebuilt-inproperties.

NoteAuser-definedPropertyobjectisassociatedonlywiththespecificinstanceofanobject.Thepropertyisn'tdefinedforallinstancesofobjectsoftheselectedtype.

YoucanusethePropertiescollectionofanobjecttoenumeratetheobject'sbuilt-inanduser-definedproperties.Youdon'tneedtoknowbeforehandexactlywhichpropertiesexistorwhattheircharacteristics(NameandTypeproperties)aretomanipulatethem.However,ifyoutrytoreadawrite-onlyproperty,suchasthePasswordpropertyofaWorkspaceobject,ortrytoreadorwriteapropertyinaninappropriatecontext,suchastheValuepropertysettingofaFieldobjectintheFieldscollectionofaTableDefobject,anerroroccurs.

Torefertoabuilt-inPropertyobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

object.Properties(0)

object.Properties("name")

object.Properties![name]

Forabuilt-inproperty,youcanalsousethissyntax:

object.name

NoteForauser-definedproperty,youmustusethefullobject.Properties("name")syntax.

Page 112: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Withthesamesyntaxforms,youcanalsorefertotheValuepropertyofaPropertyobject.ThecontextofthereferencewilldeterminewhetheryouarereferringtothePropertyobjectitselfortheValuepropertyofthePropertyobject.

Page 113: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PropertyObject

APropertyobjectrepresentsabuilt-inoruser-definedcharacteristicofaDAOobject.

Remarks

EveryDAOobjectexcepttheConnectionandErrorobjectscontainsaPropertiescollectionwhichhasPropertyobjectscorrespondingtobuilt-inpropertiesofthatDAOobject.TheusercanalsodefinePropertyobjectsandappendthemtothePropertiescollectionofsomeDAOobjects.ThesePropertyobjects(whichareoftenjustcalledproperties)uniquelycharacterizethatinstanceoftheobject.

Page 114: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Youcancreateuser-definedpropertiesforthefollowingobjects:

Database,Index,QueryDef,andTableDefobjects

FieldobjectsinFieldscollectionsofQueryDefandTableDefobjects

Toaddauser-definedproperty,usetheCreatePropertymethodtocreateaPropertyobjectwithauniqueNamepropertysetting.SettheTypeandValuepropertiesofthenewPropertyobject,andthenappendittothePropertiescollectionoftheappropriateobject.Theobjecttowhichyouareaddingtheuser-definedpropertymustalreadybeappendedtoacollection.Referencingauser-definedPropertyobjectthathasnotyetbeenappendedtoaPropertiescollectionwillcauseanerror,aswillappendingauser-definedPropertyobjecttoaPropertiescollectioncontainingaPropertyobjectofthesamename.

Youcandeleteuser-definedpropertiesfromthePropertiescollection,butyoucan'tdeletebuilt-inproperties.

NoteAuser-definedPropertyobjectisassociatedonlywiththespecificinstanceofanobject.Thepropertyisn'tdefinedforallinstancesofobjectsoftheselectedtype.

YoucanusethePropertiescollectionofanobjecttoenumeratetheobject'sbuilt-inanduser-definedproperties.Youdon'tneedtoknowbeforehandexactlywhichpropertiesexistorwhattheircharacteristics(NameandTypeproperties)aretomanipulatethem.However,ifyoutrytoreadawrite-onlyproperty,suchasthePasswordpropertyofaWorkspaceobject,ortrytoreadorwriteapropertyinaninappropriatecontext,suchastheValuepropertysettingofaFieldobjectintheFieldscollectionofaTableDefobject,anerroroccurs.

ThePropertyobjectalsohasfourbuilt-inproperties:

TheNameproperty,aStringthatuniquelyidentifiestheproperty.

Page 115: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TheTypeproperty,anIntegerthatspecifiesthepropertydatatype.

TheValueproperty,aVariantthatcontainsthepropertysetting.

TheInheritedproperty,aBooleanthatindicateswhetherthepropertyisinheritedfromanotherobject.Forexample,aFieldobjectinaFieldscollectionofaRecordsetobjectcaninheritpropertiesfromtheunderlyingTableDeforQueryDefobject.

Torefertoabuilt-inPropertyobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

object.Properties(0)

object.Properties("name")

object.Properties![name]

Forabuilt-inproperty,youcanalsousethissyntax:

object.name

NoteForauser-definedproperty,youmustusethefullobject.Properties("name")syntax.

Withthesamesyntaxforms,youcanalsorefertotheValuepropertyofaPropertyobject.ThecontextofthereferencewilldeterminewhetheryouarereferringtothePropertyobjectitselfortheValuepropertyofthePropertyobject.

Page 116: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PropertyObject,PropertiesCollectionSummary

PropertyObject

APropertyobjectcontainsnomethods;itcontainsthiscollectionandtheseproperties.

Collection

Properties

Properties

Inherited(AlwaysFalseinODBCDirectdatabases)NameTypeValue

PropertiesCollection

APropertiescollectionappearsineachoftheotherDAOobjectsexcepttheConnectionandErrorobjects,andcontainsthesemethodsandthisproperty.

Methods

AppendDeleteRefresh

Page 117: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Property

Count

Page 118: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

QueryDefsCollection

AQueryDefscollectioncontainsallQueryDefobjectsofaDatabaseobjectinaMicrosoftJetdatabase,andallQueryDefobjectsofaConnectionobjectinanODBCDirectworkspace.

Remarks

TocreateanewQueryDefobject,usetheCreateQueryDefmethod.InaMicrosoftJetworkspace,ifyousupplyastringforthenameargumentor

Page 119: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ifyouexplicitlysettheNamepropertyofthenewQueryDefobjecttoanon–zero-lengthstring,youwillcreateapermanentQueryDefthatwillautomaticallybeappendedtotheQueryDefscollectionandsavedtodisk.Supplyingazero-lengthstringasthenameargumentorexplicitlysettingtheNamepropertytoazero-lengthstringwillresultinatemporaryQueryDefobject.

InanODBCDirectworkspace,aQueryDefisalwaystemporary.TheQueryDefscollectioncontainsallopenQueryDefobjects.WhenaQueryDefisclosed,itisautomaticallyremovedfromtheQueryDefscollection.

TorefertoaQueryDefobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

QueryDefs(0)

QueryDefs("name")

QueryDefs![name]

YoucanrefertotemporaryQueryDefobjectsonlybytheobjectvariablesthatyouhaveassignedtothem.

Page 120: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

QueryDefObject

AQueryDefobjectisastoreddefinitionofaqueryinaMicrosoftJetdatabase,oratemporarydefinitionofaqueryinanODBCDirectworkspace.

Remarks

YoucanusetheQueryDefobjecttodefineaquery.Forexample,youcan:

Page 121: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsetheSQLpropertytosetorreturnthequerydefinition.

UsetheQueryDefobject'sParameterscollectiontosetorreturnqueryparameters.

UsetheTypepropertytoreturnavalueindicatingwhetherthequeryselectsrecordsfromanexistingtable,makesanewtable,insertsrecordsfromonetableintoanothertable,deletesrecords,orupdatesrecords.

UsetheMaxRecordspropertytolimitthenumberofrecordsreturnedfromaquery.

UsetheODBCTimeoutpropertytoindicatehowlongtowaitbeforethequeryreturnsrecords.TheODBCTimeoutpropertyappliestoanyquerythataccessesODBCdata.

InaMicrosoftJetworkspace,youcanalso:

UsetheReturnsRecordspropertytoindicatethatthequeryreturnsrecords.TheReturnsRecordspropertyisonlyvalidonSQLpass-throughqueries.

UsetheConnectpropertytomakeanSQLpass-throughquerytoanODCdatabase.

InanODBCDirectworkspace,youcanalso:

UsethePreparepropertytodeterminewhethertoinvoketheODBCSQLPrepareAPIwhenthequeryisexecuted.

Page 122: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsetheCacheSizepropertytocacherecordsreturnedfromaquery.

YoucanalsocreatetemporaryQueryDefobjects.UnlikepermanentQueryDefobjects,temporaryQueryDefobjectsarenotsavedtodiskorappendedtotheQueryDefscollection.TemporaryQueryDefobjectsareusefulforqueriesthatyoumustrunrepeatedlyduringruntimebutdonotnotneedtosavetodisk,particularlyifyoucreatetheirSQLstatementsduringruntime.

YoucanthinkofapermanentQueryDefobjectinaMicrosoftJetworkspacesasacompiledSQLstatement.IfyouexecuteaqueryfromapermanentQueryDefobject,thequerywillrunfasterthanifyouruntheequivalentSQLstatementfromtheOpenRecordsetmethod.ThisisbecausetheMicrosoftJetdatabaseenginedoesn'tneedtocompilethequerybeforeexecutingit.

ThepreferredwaytousethenativeSQLdialectofanexternaldatabaseengineaccessedthroughtheMicrosoftJetdatabaseengineisthroughQueryDefobjects.Forexample,youcancreateaMicrosoftSQLServerqueryandstoreitinaQueryDefobject.Whenyouneedtouseanon-MicrosoftJetdatabaseengineSQLquery,youmustprovideaConnectpropertystringthatpointstotheexternaldatasource.QuerieswithvalidConnectpropertiesbypasstheMicrosoftJetdatabaseengineandpassthequerydirectlytotheexternaldatabaseserverforprocessing.

TocreateanewQueryDefobject,usetheCreateQueryDefmethod.InaMicrosoftJetworkspace,ifyousupplyastringforthenameargumentorifyouexplicitlysettheNamepropertyofthenewQueryDefobjecttoanon–zero-lengthstring,youwillcreateapermanentQueryDefthatwillautomaticallybeappendedtotheQueryDefscollectionandsavedtodisk.Supplyingazero-lengthstringasthenameargumentorexplicitlysettingtheNamepropertytoazero-lengthstringwillresultinatemporaryQueryDefobject.

InanODBCDirectworkspace,aQueryDefisalwaystemporary.TheQueryDefscollectioncontainsallopenQueryDefobjects.Whena

Page 123: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

QueryDefisclosed,itisautomaticallyremovedfromtheQueryDefscollection.

TorefertoaQueryDefobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

QueryDefs(0)

QueryDefs("name")

QueryDefs![name]

YoucanrefertotemporaryQueryDefobjectsonlybytheobjectvariablesthatyouhaveassignedtothem.

Page 124: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

QueryDefObject,QueryDefsCollectionSummary

QueryDefObject

AQueryDefobjectcontainsthesecollections,methods,andproperties.

Legend:

AvailableonlyinaMicrosoftJetworkspace.

AvailableonlyinanODBCDirectworkspace.

Collections

FieldsParameters(default)Properties

Methods

CancelCloseCreatePropertyExecuteOpenRecordset

Properties

Page 125: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CacheSizeConnectDateCreatedKeepLocalLastUpdatedLogMessagesMaxRecordsNameODBCTimeoutPrepareRecordsAffectedReplicableReturnsRecordsSQLStillExecutingTypeUpdatable

QueryDefsCollection

AQueryDefscollectionappearsineachConnectionobjectinanODBCDirectworkspace,andeachDatabaseobject,andcontainsthesemethodsandthisproperty.

Methods

AppendDeleteRefresh

Property

Count

Page 126: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RecordsetsCollection

ARecordsetscollectioncontainsallopenRecordsetobjectsinaConnectionorDatabaseobject.

Remarks

WhenyouuseDAOobjects,youmanipulatedataalmostentirelyusingRecordsetobjects.

AnewRecordsetobjectisautomaticallyaddedtotheRecordsets

Page 127: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

collectionwhenyouopentheRecordsetobject,andisautomaticallyremovedwhenyoucloseit.

YoucancreateasmanyRecordsetobjectvariablesasneeded.DifferentRecordsetobjectscanaccessthesametables,queries,andfieldswithoutconflicting.

TorefertoaRecordsetobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Recordsets(0)

Recordsets("name")

Recordsets![name]

NoteYoucanopenaRecordsetobjectfromthesamedatasourceordatabasemorethanonce,creatingduplicatenamesintheRecordsetscollection.YoushouldassignRecordsetobjectstoobjectvariablesandrefertothembyvariablename.

Page 128: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RecordsetObject

ARecordsetobjectrepresentstherecordsinabasetableortherecordsthatresultfromrunningaquery.

Remarks

YouuseRecordsetobjectstomanipulatedatainadatabaseattherecordlevel.WhenyouuseDAOobjects,youmanipulatedataalmostentirelyusingRecordsetobjects.AllRecordsetobjectsareconstructedusingrecords(rows)andfields(columns).Therearefivetypesof

Page 129: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Recordsetobjects:

Table-typeRecordset—representationincodeofabasetablethatyoucanusetoadd,change,ordeleterecordsfromasingledatabasetable(MicrosoftJetworkspacesonly).

Dynaset-typeRecordset—theresultofaquerythatcanhaveupdatablerecords.Adynaset-typeRecordsetobjectisadynamicsetofrecordsthatyoucanusetoadd,change,ordeleterecordsfromanunderlyingdatabasetableortables.Adynaset-typeRecordsetobjectcancontainfieldsfromoneormoretablesinadatabase.ThistypecorrespondstoanODBCkeysetcursor.

Snapshot-typeRecordset—astaticcopyofasetofrecordsthatyoucanusetofinddataorgeneratereports.Asnapshot-typeRecordsetobjectcancontainfieldsfromoneormoretablesinadatabasebutcan'tbeupdated.ThistypecorrespondstoanODBCstaticcursor.

Forward-only-typeRecordset—identicaltoasnapshotexceptthatnocursorisprovided.Youcanonlyscrollforwardthroughrecords.Thisimprovesperformanceinsituationswhereyouonlyneedtomakeasinglepassthrougharesultset.ThistypecorrespondstoanODBCforward-onlycursor.

Dynamic-typeRecordset—aqueryresultsetfromoneormorebasetablesinwhichyoucanadd,change,ordeleterecordsfromarow-returningquery.Further,recordsotherusersadd,delete,oreditinthebasetablesalsoappearinyourRecordset.ThistypecorrespondstoanODBCdynamiccursor(ODBCDirectworkspacesonly).

Page 130: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

YoucanchoosethetypeofRecordsetobjectyouwanttocreateusingthetypeargumentoftheOpenRecordsetmethod.

InaMicrosoftJetworkspace,ifyoudon'tspecifyatype,DAOattemptstocreatethetypeofRecordsetwiththemostfunctionalityavailable,startingwithtable.Ifthistypeisn’tavailable,DAOattemptsadynaset,thenasnapshot,andfinallyaforward-onlytypeRecordsetobject.

InanODBCDirectworkspace,ifyoudon'tspecifyatype,DAOattemptstocreatethetypeofRecordsetwiththefastestqueryresponse,startingwithforward-only.Ifthistypeisn'tavailable,DAOattemptsasnapshot,thenadynaset,andfinallyadynamic-typeRecordsetobject.

WhencreatingaRecordsetobjectusinganon-linkedTableDefobjectinaMicrosoftJetworkspace,table-typeRecordsetobjectsarecreated.Onlydynaset-typeorsnapshot-typeRecordsetobjectscanbecreatedwithlinkedtablesortablesinMicrosoftJet-connectedODBCdatabases.

AnewRecordsetobjectisautomaticallyaddedtotheRecordsetscollectionwhenyouopentheobject,andisautomaticallyremovedwhenyoucloseit.

NoteIfyouusevariablestorepresentaRecordsetobjectandtheDatabaseobjectthatcontainstheRecordset,makesurethevariableshavethesamescope,orlifetime.Forexample,ifyoudeclareapublicvariablethatrepresentsaRecordsetobject,makesurethevariablethatrepresentstheDatabasecontainingtheRecordsetisalsopublic,orisdeclaredinaSuborFunctionprocedureusingtheStatickeyword.

YoucancreateasmanyRecordsetobjectvariablesasneeded.DifferentRecordsetobjectscanaccessthesametables,queries,andfieldswithoutconflicting.

Dynaset-,snapshot-,andforward-only–typeRecordsetobjectsarestoredinlocalmemory.Ifthereisn'tenoughspaceinlocalmemorytostorethedata,theMicrosoftJetdatabaseenginesavestheadditionaldatatoTEMPdiskspace.Ifthisspaceisexhausted,atrappableerror

Page 131: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

occurs.

ThedefaultcollectionofaRecordsetobjectistheFieldscollection,andthedefaultpropertyofaFieldobjectistheValueproperty.Usethesedefaultstosimplifyyourcode.

WhenyoucreateaRecordsetobject,thecurrentrecordispositionedtothefirstrecordifthereareanyrecords.Iftherearenorecords,theRecordCountpropertysettingis0,andtheBOFandEOFpropertysettingsareTrue.

YoucanusetheMoveNext,MovePrevious,MoveFirst,andMoveLastmethodstorepositionthecurrentrecord.Forward-only–typeRecordsetobjectssupportonlytheMoveNextmethod.WhenusingtheMovemethodstovisiteachrecord(or"walk"throughtheRecordset),youcanusetheBOFandEOFpropertiestocheckforthebeginningorendoftheRecordsetobject.

Withdynaset-andsnapshot-typeRecordsetobjectsinaMicrosoftJetworkspace,youcanalsousetheFindmethods,suchasFindFirst,tolocateaspecificrecordbasedoncriteria.Iftherecordisn'tfound,theNoMatchpropertyissettoTrue.Fortable-typeRecordsetobjects,youcanscanrecordsusingtheSeekmethod.

TheTypepropertyindicatesthetypeofRecordsetobjectcreated,andtheUpdatablepropertyindicateswhetheryoucanchangetheobject'srecords.

Informationaboutthestructureofabasetable,suchasthenamesanddatatypesofeachFieldobjectandanyIndexobjects,isstoredinaTableDefobject.

TorefertoaRecordsetobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Recordsets(0)

Recordsets("name")

Page 132: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Recordsets![name]

NoteYoucanopenaRecordsetobjectfromthesamedatasourceordatabasemorethanonce,creatingduplicatenamesintheRecordsetscollection.YoushouldassignRecordsetobjectstoobjectvariablesandrefertothembyvariablename.

Page 133: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RecordsetObject,RecordsetsCollectionSummary

RecordsetObject

ARecordsetobjectcontainsthesecollections,methods,andproperties.

Legend:

FeatureavailableinbothMicrosoftJetandODBCDirectworkspaces.

FeatureavailableinMicrosoftJetworkspacesonly.

FeatureavailableinODBCDirectworkspacesonly.

Collections

Fields(default)Properties

RecordsetMethods

ThefollowingtablelistsalloftheRecordsetmethods,andshowswhichRecordsettypesupportseachmethod,andwhetherthemethodisavailableineitheraMicrosoftJetorODBCDirectworkspace,orboth.

Method Table Dynaset Snapshot Forward-OnlyDynamicAddNew *CancelCancelUpdate *

Page 134: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CloneCloseCopyQueryDefDelete *Edit *FillCacheFindFirstFindLastFindNextFindPreviousGetRows

Move

Onlywithforwardmovesthatdon'tuseabookmarkoffset

MoveFirstMoveLastMoveNextMovePreviousNextRecordsetOpenRecordsetRequerySeekUpdate *

*InanODBCDirectworkspace,asnapshot-typeRecordsetmaybeupdatable,dependingontheODBCdriver.TheAddNew,Edit,Delete,Update,andCancelUpdatemethodsareonlyavailableonODBCDirectsnapshot-typeRecordsetobjectsiftheODBCdriversupportsupdatablesnapshots.

RecordsetProperties

ThefollowingtableindicateswhichpropertiesapplytoeachtypeofRecordsetobjectandwhetherthepropertysettingisread/write,read-only,oralwaysFalseineitherMicrosoftJetorODBCDirectdatabases.

Read-only

Page 135: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Read/write

Property Table Dynaset Snapshot Forward-Only Dynamic

AbsolutePositionBatchCollisionCountBatchCollisionsBatchSizeBOFBookmarkBookmarkable

CacheSizefor

MicrosoftJetworkspacesfor

ODBCDirectworkspaces

CacheStartConnectionDateCreatedEditModeEOFFilterIndexLastModified *LastUpdated

LockEditsfor

MicrosoftJetworkspaces

forMicrosoftJetworkspaces

forODBCDirectworkspaces

forODBCDirectworkspaces

NameNoMatchPercentPositionRecordCountRecordStatusRestartable False

Page 136: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Sort

StillExecuting

Transactions AlwaysFalse

AlwaysFalse

Type

Updatable

AlwaysFalseinMicrosoftJetworkspaces

AlwaysFalseinMicrosoftJetworkspaces

inODBCDirectworkspaces*

inODBCDirectworkspaces*

UpdateOptionsValidationRuleValidationText

*InanODBCDirectworkspace,asnapshot-typeRecordsetmaybeupdatable,dependingontheODBCdriver.TheLastModifiedpropertyisavailable,andtheUpdatablepropertyisTrueonlyonODBCDirectsnapshot-typeRecordsetobjectsiftheODBCdriversupportsupdatablesnapshots.

RecordsetsCollection

ARecordsetscollectionappearsineachConnectionandDatabaseobject,andcontainsthismethodandthisproperty.

Method

Refresh

Property

Count

Page 137: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RelationsCollection

ARelationscollectioncontainsstoredRelationobjectsofaDatabaseobject(MicrosoftJetdatabasesonly).

Remarks

YoucanusetheRelationobjecttocreatenewrelationshipsandexamineexistingrelationshipsinyourdatabase.ToaddaRelationobjecttotheRelationscollection,firstcreateitwiththeCreateRelationmethod,andthenappendittotheRelationscollectionwiththeAppendmethod.ThiswillsavetheRelationobjectwhenyouclosetheDatabaseobject.To

Page 138: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

removeaRelationobjectfromthecollection,usetheDeletemethod.

TorefertoaRelationobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Relations(0)

Relations("name")

Relations![name]

Page 139: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RelationObject

ARelationobjectrepresentsarelationshipbetweenfieldsintablesorqueries(MicrosoftJetdatabasesonly).

Remarks

YoucanusetheRelationobjecttocreatenewrelationshipsandexamineexistingrelationshipsinyourdatabase.

UsingaRelationobjectanditsproperties,youcan:

Page 140: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Specifyanenforcedrelationshipbetweenfieldsinbasetables(butnotarelationshipthatinvolvesaqueryoralinkedtable).

Establishunenforcedrelationshipsbetweenanytypeoftableorquery—nativeorlinked.

UsetheNamepropertytorefertotherelationshipbetweenthefieldsinthereferencedprimarytableandthereferencingforeigntable.

UsetheAttributespropertytodeterminewhethertherelationshipbetweenfieldsinthetableisone-to-oneorone-to-manyandhowtoenforcereferentialintegrity.

UsetheAttributespropertytodeterminewhethertheMicrosoftJetdatabaseenginecanperformcascadingupdateandcascadingdeleteoperationsonprimaryandforeigntables.

UsetheAttributespropertytodeterminewhethertherelationshipbetweenfieldsinthetableisleftjoinorrightjoin.

UsetheNamepropertyofallFieldobjectsintheFieldscollectionofaRelationobjecttosetorreturnthenamesofthefieldsintheprimarykeyofthereferencedtable,ortheForeignNamepropertysettingsoftheFieldobjectstosetorreturnthenamesofthefieldsintheforeignkeyofthereferencingtable.

Ifyoumakechangesthatviolatetherelationshipsestablishedforthe

Page 141: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

database,atrappableerroroccurs.Ifyourequestcascadingupdateorcascadingdeleteoperations,theMicrosoftJetdatabaseenginealsomodifiestheprimaryorforeignkeytablestoenforcetherelationshipsyouestablish.

Forexample,theNorthwinddatabasecontainsarelationshipbetweenanOrderstableandaCustomerstable.TheCustomerIDfieldoftheCustomerstableistheprimarykey,andtheCustomerIDfieldoftheOrderstableistheforeignkey.ForMicrosoftJettoacceptanewrecordintheOrderstable,itsearchestheCustomerstableforamatchontheCustomerIDfieldoftheOrderstable.IfMicrosoftJetdoesn'tfindamatch,itdoesn'tacceptthenewrecord,andatrappableerroroccurs.

Whenyouenforcereferentialintegrity,auniqueindexmustalreadyexistforthekeyfieldofthereferencedtable.TheMicrosoftJetdatabaseengineautomaticallycreatesanindexwiththeForeignpropertysettoactastheforeignkeyinthereferencingtable.

TocreateanewRelationobject,usetheCreateRelationmethod.TorefertoaRelationobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Relations(0)

Relations("name")

Relations![name]

Page 142: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RelationObject,RelationsCollectionSummary

RelationObject

ARelationobjectcontainsthesecollections,thismethod,andtheseproperties.

Collections

Fields(Default)Properties

Method

CreateField

Properties

AttributesForeignTableNamePartialReplicaTable

RelationsCollection

ARelationscollectioniscontainedineachDatabaseobjectofaMicrosoftJetdatabase,andcontainsthesemethodsandthisproperty.

Page 143: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Methods

AppendDeleteRefresh

Property

Count

Page 144: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Snapshot-TypeRecordsetObject

Asnapshot-typeRecordsetobjectisastaticsetofrecordsthatyoucanusetoexaminedatainanunderlyingtableortables.InanODBCDirectdatabase,asnapshot-typeRecordsetobjectcorrespondstoastaticcursor.

Remarks

Tocreateasnapshot-typeRecordsetobject,usetheOpenRecordsetmethodonanopendatabase,onanotherdynaset-orsnapshot-typeRecordsetobject,oronaQueryDefobject.

Asnapshot-typeRecordsetobjectcancontainfieldsfromoneormoretablesinadatabase.InaMicrosoftJetworkspace,asnapshotcan'tbeupdated.InanODBCDirectworkspace,asnapshotmaybeupdatable,

Page 145: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dependingontheODBCdriver.

Whenyoucreateasnapshot-typeRecordsetobject,datavaluesforallfields(exceptMemoandOLEObject(LongBinary)fielddatatypesin.mdbfiles)arebroughtintomemory.Onceloaded,changesmadetobasetabledataaren'treflectedinthesnapshot-typeRecordsetobjectdata.Toreloadthesnapshot-typeRecordsetobjectwithcurrentdata,usetheRequerymethod,orre-executetheOpenRecordsetmethod.

Theorderofsnapshot-typeRecordsetobjectdatadoesn'tnecessarilyfollowanyspecificsequence.Toorderyourdata,useanSQLstatementwithanORDERBYclausetocreatetheRecordsetobject.YoucanalsousethistechniquetofiltertherecordssothatonlycertainrecordsareaddedtotheRecordsetobject.UsingthistechniqueinsteadofusingtheFilterorSortpropertiesortestingeachrecordindividuallygenerallyresultsinfasteraccesstoyourdata.

Snapshot-typeRecordsetobjectsaregenerallyfastertocreateandaccessthandynaset-typeRecordsetobjectsbecausetheirrecordsareeitherinmemoryorstoredinTEMPdiskspace,andtheMicrosoftJetdatabaseenginedoesn'tneedtolockpagesorhandlemultiuserissues.However,snapshot-typeRecordsetobjectsusemoreresourcesthandynaset-typeRecordsetobjectsbecausetheentirerecordisdownloadedtolocalmemory.

Page 146: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Snapshot-TypeRecordsetObjectSummary

Thesnapshot-typeRecordsetobjectcontainsthesecollections,methods,andproperties.

Legend:

FeatureavailableinMicrosoftJetworkspacesonly.

FeatureavailableinODBCDirectworkspacesonly.

Collections

Fields(default)PropertiesMethods RestrictionsAddNew *CancelCancelUpdate *CloneCloseCopyQueryDefDelete *Edit *FindFirstFindLastFindNextFindPreviousGetRowsMove

Page 147: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MoveFirstMoveLastMoveNextMovePreviousNextRecordsetOpenRecordsetRequeryUpdate *

*InanODBCDirectworkspace,asnapshot-typeRecordsetmaybeupdatable,dependingontheODBCdriver.TheAddNew,Edit,Delete,Update,andCancelUpdatemethodsareonlyavailableonODBCDirectsnapshot-typeRecordsetobjectsiftheODBCdriversupportsupdatablesnapshots.

Properties

Thefollowingtableindicateswhetherthepropertysettingisread/write,read-only,oralwaysFalseineitherMicrosoftJetorODBCDirectworkspaces.

Read-only

Read/write

Properties RestrictionsAbsolutePositionBatchCollisionCountBatchCollisionsBatchSizeBOFBookmarkBookmarkableCacheSizeConnectionEditModeEOFFilterLastModified *

Page 148: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

LockEdits

NameNoMatchPercentPositionRecordCountRecordStatusRestartableSortStillExecutingTransactions AlwaysFalseType

UpdatableAlwaysFalseinMicrosoftJetworkspaces;inODBCDirectworkspaces*

UpdateOptionsValidationRuleValidationText

*InanODBCDirectworkspace,asnapshot-typeRecordsetmaybeupdatable,dependingontheODBCdriver.TheLastModifiedpropertyisavailable,andtheUpdatablepropertyisTrueonlyonODBCDirectsnapshot-typeRecordsetobjectsiftheODBCdriversupportsupdatablesnapshots.

Page 149: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TableDefsCollection

ATableDefscollectioncontainsallstoredTableDefobjectsinadatabase(MicrosoftJetworkspacesonly).

Remarks

YoumanipulateatabledefinitionusingaTableDefobjectanditsmethodsandproperties.

ThedefaultcollectionofaDatabaseobjectistheTableDefscollection.

Page 150: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TorefertoaTableDefobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

TableDefs(0)

TableDefs("name")

TableDefs![name]

Page 151: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TableDefObject

ATableDefobjectrepresentsthestoreddefinitionofabasetableoralinkedtable(MicrosoftJetworkspacesonly).

Remarks

YoumanipulateatabledefinitionusingaTableDefobjectanditsmethodsandproperties.Forexample,youcan:

Examinethefieldandindexstructureofanylocal,linked,or

Page 152: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

externaltableinadatabase.

UsetheConnectandSourceTableNamepropertiestosetorreturninformationaboutlinkedtables,andusetheRefreshLinkmethodtoupdateconnectionstolinkedtables.

UsetheValidationRuleandValidationTextpropertiestosetorreturnvalidationconditions.

UsetheOpenRecordsetmethodtocreateatable-,dynaset-,dynamic-,snapshot-,orforward-only–typeRecordsetobject,basedonthetabledefinition.

Forbasetables,theRecordCountpropertycontainsthenumberofrecordsinthespecifieddatabasetable.Forlinkedtables,theRecordCountpropertysettingisalways-1.

TocreateanewTableDefobject,usetheCreateTableDefmethod.

Page 153: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Toaddafieldtoatable

1. MakesureanyRecordsetobjectsbasedonthetableareallclosed.

2. UsetheCreateFieldmethodtocreateaFieldobjectvariableandsetitsproperties.

3. UsetheAppendmethodtoaddtheFieldobjecttotheFieldscollectionoftheTableDefobject.

YoucandeleteaFieldobjectfromaTableDefscollectionifitdoesn'thaveanyindexesassignedtoit,butyouwilllosethefield'sdata.

Page 154: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Tocreateatablethatisreadyfornewrecordsinadatabase

4. UsetheCreateTableDefmethodtocreateaTableDefobject.

5. Setitsproperties.

6. Foreachfieldinthetable,usetheCreateFieldmethodtocreateaFieldobjectvariableandsetitsproperties.

7. UsetheAppendmethodtoaddthefieldstotheFieldscollectionoftheTableDefobject.

8. UsetheAppendmethodtoaddthenewTableDefobjecttotheTableDefscollectionoftheDatabaseobject.

AlinkedtableisconnectedtothedatabasebytheSourceTableNameandConnectpropertiesoftheTableDefobject.

Page 155: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Tolinkatabletoadatabase

9. UsetheCreateTableDefmethodtocreateaTableDefobject.

10. SetitsConnectandSourceTableNameproperties(andoptionally,itsAttributesproperty).

11. UsetheAppendmethodtoaddittotheTableDefscollectionofaDatabase.

TorefertoaTableDefobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

TableDefs(0)

TableDefs("name")

TableDefs![name]

Page 156: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TableDefObject,TableDefsCollectionSummary

TableDefObject

ATableDefobjectcontainsthesecollections,methods,andproperties.

Collections

Fields(Default)IndexesProperties

Methods

CreateFieldCreateIndexCreatePropertyOpenRecordsetRefreshLink

Properties

AttributesConflictTableConnectDateCreatedKeepLocal(user-defined)LastUpdatedName

Page 157: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RecordCountReplicable(user-defined)ReplicaFilterSourceTableNameUpdatableValidationRuleValidationText

ATableDefobjectmayalsocontainapplication-definedproperties.Fordetailsonreadingandsettingtheseproperties,refertotheapplication'sonlineHelp.

TableDefsCollection

ATableDefscollectioniscontainedineachDatabaseobjectinaMicrosoftJetdatabase,andcontainsthesemethodsandthisproperty.

Methods

AppendDeleteRefresh

Property

Count

Page 158: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Table-TypeRecordsetObject

Atable-typeRecordsetobjectrepresentsabasetableyoucanusetoadd,change,ordeleterecordsfromatable.Onlythecurrentrecordisloadedintomemory.ApredefinedindexdeterminestheorderoftherecordsintheRecordsetobject(MicrosoftJetworkspacesonly).

Remarks

Tocreateatable-typeRecordsetobject,usetheOpenRecordsetmethodonanopenDatabaseobject.

Youcancreateatable-typeRecordsetobjectfromabasetableofaMicrosoftJetdatabase,butnotfromanODBCorlinkedtable.Youcanusethetable-typeRecordsetobjectwithISAMdatabases(likeFoxPro,dBASE,orParadox)whenyouopenthemdirectly.

Page 159: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Unlikedynaset-orsnapshot-typeRecordsetobjects,thetable-typeRecordsetobjectcan'trefertomorethanonebasetable,andyoucan'tcreateitwithanSQLstatementthatfiltersorsortsthedata.Generally,whenyouaccessatable-typeRecordsetobject,youspecifyoneofthepredefinedindexesforthetable,whichordersthedatareturnedtoyourapplication.Ifthetabledoesn'thaveanindex,thedatawon'tnecessarilybeinaparticularorder.Ifnecessary,yourapplicationcancreateanindexthatreturnsrecordsinaspecificorder.Tochooseaspecificorderforyourtable-typeRecordsetobject,settheIndexpropertytoavalidindex.

Alsounlikedynaset-orsnapshot-typeRecordsetobjects,youdon'tneedtoexplicitlypopulatetable-typeRecordsetobjectstoobtainanaccuratevaluefortheRecordCountproperty.

Tomaintaindataintegrity,table-typeRecordsetobjectsarelockedduringtheEditandUpdatemethodsoperationssothatonlyoneusercanupdateaparticularrecordatatime.WhentheMicrosoftJetdatabaseenginelocksarecord,itlockstheentire2Kpagecontainingtherecord.

Twokindsoflockingareusedwithnon-ODBCtables—pessimisticandoptimistic.ODBC-accessedtablesalwaysuseoptimisticlocking.TheLockEditspropertydeterminesthelockingconditionsineffectduringediting.

Page 160: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Table-TypeRecordsetObjectSummary

Atable-typeRecordsetobjectcontainsthesecollections,methods,andproperties.ThistypeofRecordsetanditsmethodsandpropertiesareavailableonlyinaMicrosoftJetworkspace.

Collections

Fields(default)Properties

Methods

AddNewCancelUpdateCloneCloseDeleteEditGetRowsMoveMoveFirstMoveLastMoveNextMovePreviousOpenRecordsetSeekUpdate

Page 161: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Properties

Thefollowingtableindicateswhethereachpropertysettingisread/write,read-only,oralwaysFalse.

Read-only

Read/write

Properties RestrictionsBOFBookmarkBookmarkableDateCreatedEditModeEOFIndexLastModifiedLastUpdatedLockEditsNameNoMatchPercentPositionRecordCountRestartable AlwaysFalseTransactionsTypeUpdatableValidationRuleValidationText

Page 162: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsersCollection

AUserscollectioncontainsallstoredUserobjectsofaWorkspaceorGroupobject(MicrosoftJetworkspacesonly).

Remarks

YoucanappendanexistingUserobjecttotheUserscollectionofaGroupobjecttogiveauseraccounttheaccesspermissionsforthatGroupobject.Alternatively,youcanappendtheGroupobjecttotheGroupscollectioninaUserobjecttoestablishmembershipoftheuser

Page 163: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

accountinthatgroup.IfyouuseaUsersorGroupscollectionotherthantheonetowhichyoujustappendedanobject,youmayneedtousetheRefreshmethod.

TheMicrosoftJetdatabaseenginepredefinestwoUserobjectsnamedAdminandGuest.TheuserAdminisamemberofbothoftheGroupobjectsnamedAdminsandUsers;theuserGuestisamemberonlyoftheGroupobjectnamedGuests.

TorefertoaUserobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

[workspace|group].Users(0)

[workspace|group].Users("name")

[workspace|group].Users![name]

Page 164: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UserObject

AUserobjectrepresentsauseraccountthathasaccesspermissionswhenaWorkspaceobjectoperatesasasecureworkgroup(MicrosoftJetworkspacesonly).

Remarks

YouuseUserobjectstoestablishandenforceaccesspermissionsfortheDocumentobjectsthatrepresentdatabases,tables,andqueries.Also,ifyouknowthepropertiesofaspecificUserobject,youcancreate

Page 165: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

anewWorkspaceobjectthathasthesameaccesspermissionsastheUserobject.

YoucanappendanexistingUserobjecttotheUserscollectionofaGroupobjecttogiveauseraccounttheaccesspermissionsforthatGroupobject.Alternatively,youcanappendtheGroupobjecttotheGroupscollectioninaUserobjecttoestablishmembershipoftheuseraccountinthatgroup.IfyouuseaUsersorGroupscollectionotherthantheonetowhichyoujustappendedanobject,youmayneedtousetheRefreshmethod.

WiththepropertiesofaUserobject,youcan:

UsetheNamepropertytoreturnthenameofanexistinguser.Youcan'treturnthePIDandPasswordpropertiesofanexistingUserobject.

UsetheName,PID,andPasswordpropertiesofanewlycreated,unappendedUserobjecttoestablishtheidentityofthatUserobject.Ifyoudon'tsetthePasswordproperty,it'ssettoazero-lengthstring("").

TheMicrosoftJetdatabaseenginepredefinestwoUserobjectsnamedAdminandGuest.TheuserAdminisamemberofbothoftheGroupobjectsnamedAdminsandUsers;theuserGuestisamemberonlyoftheGroupobjectnamedGuests.

TocreateanewUserobject,usetheCreateUsermethod.

TorefertoaUserobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

[workspace|group].Users(0)

[workspace|group].Users("name")

[workspace|group].Users![name]

Page 166: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UserObject,UsersCollectionSummary

UserObject

AUserobjectcontainsthesecollections,methods,andproperties.

Collections

Groups(Default)Properties

Methods

CreateGroupNewPassword

Properties

NamePasswordPID

UsersCollection

AUserscollectioniscontainedineachGroupandMicrosoftJetWorkspaceobject,andcontainsthesemethodsandthisproperty.

Methods

Page 167: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AppendDeleteRefresh

Property

Count

Page 168: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

WorkspacesCollection

AWorkspacescollectioncontainsallactive,unhiddenWorkspaceobjectsoftheDBEngineobject.(HiddenWorkspaceobjectsarenotappendedtothecollectionandreferencedbythevariabletowhichtheyareassigned.)

Remarks

Page 169: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UsetheWorkspaceobjecttomanagethecurrentsessionortostartanadditionalsession.

WhenyoufirstrefertooruseaWorkspaceobject,youautomaticallycreatethedefaultworkspace,DBEngine.Workspaces(0).ThesettingsoftheNameandUserNamepropertiesofthedefaultworkspaceare"#DefaultWorkspace#"and"Admin,"respectively.Ifsecurityisenabled,theUserNamepropertysettingisthenameoftheuserwhologgedon.

YoucancreatenewWorkspaceobjectswiththeCreateWorkspacemethod.AfteryoucreateanewWorkspaceobject,youmustappendittotheWorkspacescollectionifyouneedtorefertoitfromtheWorkspacescollection.Youcan,however,useanewlycreatedWorkspaceobjectwithoutappendingittotheWorkspacescollection.

TorefertoaWorkspaceobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

DBEngine.Workspaces(0)

DBEngine.Workspaces("name")

DBEngine.Workspaces![name]

Page 170: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

WorkspaceObject

AWorkspaceobjectdefinesanamedsessionforauser.Itcontainsopendatabasesandprovidesmechanismsforsimultaneoustransactionsand,inMicrosoftJetworkspaces,secureworkgroupsupport.ItalsocontrolswhetheryouaregoingthroughtheMicrosoftJetdatabaseengineorODBCDirecttoaccessexternaldata.

Page 171: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Remarks

AWorkspaceisanon-persistentobjectthatdefineshowyourapplicationinteractswithdata—eitherbyusingtheMicrosoftJetdatabaseengine,orODBCDirect.UsetheWorkspaceobjecttomanagethecurrentsessionortostartanadditionalsession.Inasession,youcanopenmultipledatabasesorconnections,andmanagetransactions.Forexample,youcan:

UsetheName,UserName,andTypepropertiestoestablishanamedsession.Thesessioncreatesascopeinwhichyoucanopenmultipledatabasesandconductoneinstanceofnestedtransactions.

UsetheClosemethodtoterminateasession.

UsetheOpenDatabasemethodtoopenoneormoreexistingdatabasesonaWorkspace.

UsetheBeginTrans,CommitTrans,andRollbackmethodstomanagenestedtransactionprocessingwithinaWorkspaceanduseseveralWorkspaceobjectstoconductmultiple,simultaneous,andoverlappingtransactions.

Further,usingaMicrosoftJetdatabase,youcanestablishsecuritybasedonusernamesandpasswords:

UsetheGroupsandUserscollectionstoestablishgroupanduseraccesspermissionstoobjectsintheWorkspace.

UsetheIsolateODBCTranspropertytoisolatemultipletransactionsthatinvolvethesameMicrosoftJet-connectedODBC

Page 172: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

database.

NoteForacompletelistofallmethods,properties,andcollectionsavailableonaWorkspaceobjectineitheraMicrosoftJetdatabaseoranODBCDirectdatabase,seetheSummarytopic.

WhenyoufirstrefertooruseaWorkspaceobject,youautomaticallycreatethedefaultworkspace,DBEngine.Workspaces(0).ThesettingsoftheNameandUserNamepropertiesofthedefaultworkspaceare"#DefaultWorkspace#"and"Admin,"respectively.Ifsecurityisenabled,theUserNamepropertysettingisthenameoftheuserwhologgedon.

ToestablishanODBCDirectWorkspaceobject,andtherebyavoidloadingtheMicrosoftJetdatabaseengineintomemory,settheDBEngineobject'sDefaultTypepropertytodbUseODBC,orsetthetypeargumentoftheCreateWorkspacemethodtodbUseODBC.

Whenyouusetransactions,alldatabasesinthespecifiedWorkspaceareaffected—evenifmultipleDatabaseobjectsareopenedintheWorkspace.Forexample,youuseaBeginTransmethod,updateseveralrecordsinadatabase,andthendeleterecordsinanotherdatabase.IfyouthenusetheRollbackmethod,boththeupdateanddeleteoperationsarecanceledandrolledback.YoucancreateadditionalWorkspaceobjectstomanagetransactionsindependentlyacrossDatabaseobjects.

YoucancreateWorkspaceobjectswiththeCreateWorkspacemethod.AfteryoucreateanewWorkspaceobject,youmustappendittotheWorkspacescollectionifyouneedtorefertoitfromtheWorkspacescollection.

YoucanuseanewlycreatedWorkspaceobjectwithoutappendingittotheWorkspacescollection.However,youmustrefertoitbytheobjectvariabletowhichyouhaveassignedit.

TorefertoaWorkspaceobjectinacollectionbyitsordinalnumberorbyitsNamepropertysetting,useanyofthefollowingsyntaxforms:

Page 173: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DBEngine.Workspaces(0)

DBEngine.Workspaces("name")

DBEngine.Workspaces![name]

Page 174: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

WorkspaceObject,WorkspacesCollectionSummary

WorkspaceObject

AWorkspaceobjectcontainsthesecollections,methods,andproperties.

Legend:

FeatureavailableinMicrosoftJetworkspacesonly.

FeatureavailableinODBCDirectworkspacesonly.

Collections

ConnectionsDatabases(default)GroupsPropertiesUsers

Methods

BeginTransCloseCommitTransCreateDatabaseCreateGroupCreateUserOpenConnection

Page 175: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

OpenDatabaseRollback

Properties

DefaultCursorDriverIsolateODBCTransLoginTimeoutNameTypeUserName

WorkspacesCollection

AWorkspacescollectioniscontainedintheDBEngineobject,andcontainsthesemethodsandthisproperty.

Methods

AppendDeleteRefresh

Property

Count

Page 176: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOMethodsbyObject

ThisreferencegroupsallDAOmethodsbyobject.ToseewhetheraparticularmethodisavailableforMicrosoftJetorODBCworkspaces,checktheHelptopicforthatmethod.

Connection

Container—nomethods

Database

Parameter—nomethods

Property—nomethods

QueryDef

Page 177: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DBEngine

Document

Error—nomethods

Field

Group

Recordset

Relation

TableDef

User

Page 178: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Index Workspace

Page 179: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOMethodsforMicrosoftJetWorkspaces

ThisreferencelistsalphabeticallyallDAOmethodsavailableforMicrosoftJetworkspaces(ISAMdatabasefiles).

Page 180: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

A-CAddNew

Append

AppendChunk

BeginTrans

CancelUpdate

Clone

Close

CommitTrans

CompactDatabase

CopyQueryDef

CreateDatabase

CreateField

CreateGroup

CreateIndex

CreateProperty

CreateQueryDef

CreateRelation

CreateTableDef

CreateUser

CreateWorkspace

Page 181: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

D-MDelete

Edit

Execute

FillCache

FindFirst

FindLast

FindNext

FindPrevious

GetChunk

GetRows

Idle

MakeReplica

Move

MoveFirst

MoveLast

MoveNext

MovePrevious

Page 182: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

N-ZNewPassword

OpenDatabase

OpenRecordset

PopulatePartialdamthPopulatePartial>langref

Refresh

RefreshLink

RegisterDatabase

RepairDatabase

Requery

Rollback

Seek

SetOption

Synchronize

Update

Page 183: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOMethodsforODBCDirectWorkspaces

ThisreferencealphabeticallylistsallDAOmethodsavailableforODBCDirectworkspaces.

Page 184: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

A-CAddNew

Append

AppendChunk

BeginTrans

Cancel

CancelUpdate

Clone

Close

CommitTrans

CreateQueryDef

CreateWorkspace

Page 185: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

D-MDelete

Edit

Execute

GetChunk

GetRows

Move

MoveFirst

MoveLast

MoveNext

MovePrevious

Page 186: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

N-ZNextRecordset

OpenConnection

OpenDatabase

OpenRecordset

Refresh

RegisterDatabase

Requery

Rollback

Update

Page 187: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AddNewMethod

CreatesanewrecordforanupdatableRecordsetobject.

Syntax

recordset.AddNew

TherecordsetplaceholderisanobjectvariablethatrepresentsanupdatableRecordsetobjecttowhichyouwanttoaddanewrecord.

Remarks

UsetheAddNewmethodtocreateandaddanewrecordintheRecordsetobjectnamedbyrecordset.Thismethodsetsthefieldstodefaultvalues,andifnodefaultvaluesarespecified,itsetsthefieldstoNull(thedefaultvaluesspecifiedforatable-typeRecordset).

Afteryoumodifythenewrecord,usetheUpdatemethodtosavethechangesandaddtherecordtotheRecordset.NochangesoccurinthedatabaseuntilyouusetheUpdatemethod.

CautionIfyouissueanAddNewandthenperformanyoperationthat

Page 188: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

movestoanotherrecord,butwithoutusingUpdate,yourchangesarelostwithoutwarning.Inaddition,ifyouclosetheRecordsetorendtheprocedurethatdeclarestheRecordsetoritsDatabaseobject,thenewrecordisdiscardedwithoutwarning.

NoteWhenyouuseAddNewinaMicrosoftJetworkspaceandthedatabaseenginehastocreateanewpagetoholdthecurrentrecord,pagelockingispessimistic.Ifthenewrecordfitsinanexistingpage,pagelockingisoptimistic.

Ifyouhaven'tmovedtothelastrecordofyourRecordset,recordsaddedtobasetablesbyotherprocessesmaybeincludediftheyarepositionedbeyondthecurrentrecord.IfyouaddarecordtoyourownRecordset,however,therecordisvisibleintheRecordsetandincludedintheunderlyingtablewhereitbecomesvisibletoanynewRecordsetobjects.

ThepositionofthenewrecorddependsonthetypeofRecordset:

Inadynaset-typeRecordsetobject,recordsareinsertedattheendoftheRecordset,regardlessofanysortingororderingrulesthatwereineffectwhentheRecordsetwasopened.

Inatable-typeRecordsetobjectwhoseIndexpropertyhasbeenset,recordsarereturnedintheirproperplaceinthesortorder.Ifyouhaven'tsettheIndexproperty,newrecordsarereturnedattheendoftheRecordset.

TherecordthatwascurrentbeforeyouusedAddNewremainscurrent.Ifyouwanttomakethenewrecordcurrent,youcansettheBookmarkpropertytothebookmarkidentifiedbytheLastModifiedpropertysetting.

NoteToadd,edit,ordeletearecord,theremustbeauniqueindexontherecordintheunderlyingdatasource.Ifnot,a"Permissiondenied"errorwilloccurontheAddNew,Delete,orEditmethodcallinaMicrosoftJetworkspace,oran"Invalidargument"errorwilloccurontheUpdatecallinanODBCDirectworkspace.

Page 189: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AppendMethod

AddsanewDAOobjecttoacollection.

Syntax

collection.Appendobject

TheAppendmethodsyntaxhastheseparts.

Part Description

collection Anobjectvariablethatrepresentsanycollectionthatcanacceptnewobjects(forlimitations,seethetableattheendofthistopic).

object Anobjectvariablethatrepresentstheobjectbeingappended,whichmustbeofthesametypeastheelementsofcollection.

Remarks

YoucanusetheAppendmethodtoaddanewtabletoadatabase,addafieldtoatable,andaddafieldtoanindex.

Theappendedobjectbecomesapersistentobject,storedondisk,untilyoudeleteitbyusingtheDeletemethod.IfcollectionisaWorkspacescollection(whichisstoredonlyinmemory),theobjectisactiveuntilyou

Page 190: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

removeitbyusingtheClosemethod.

Theadditionofanewobjectoccursimmediately,butyoushouldusetheRefreshmethodonanyothercollectionsthatmaybeaffectedbychangestothedatabasestructure.

Iftheobjectyou'reappendingisn’tcomplete(suchaswhenyouhaven’tappendedanyFieldobjectstoaFieldscollectionofanIndexobjectbeforeit’sappendedtoanIndexescollection)orifthepropertiessetinoneormoresubordinateobjectsareincorrect,usingtheAppendmethodcausesanerror.Forexample,ifyouhaven’tspecifiedafieldtypeandthentrytoappendtheFieldobjecttotheFieldscollectioninaTableDefobject,usingtheAppendmethodtriggersarun-timeerror.

ThefollowingtablelistssomelimitationsoftheAppendmethod.Theobjectinthefirstcolumnisanobjectcontainingthecollectioninthesecondcolumn.Thethirdcolumnindicateswhetheryoucanappendanobjecttothatcollection(forexample,youcanneverappendaContainerobjecttotheContainerscollectionofaDatabaseobject).

Object CollectionCanyouappendnewobjects?

DBEngine Workspaces Yes

DBEngine Errors No.NewErrorobjectsareautomaticallyappendedwhentheyoccur.

Workspace Connections No.UsingtheOpenConnectionmethodautomaticallyappendsnewobjects.

Workspace Databases No.UsingtheOpenDatabasemethodautomaticallyappendsnewobjects.

Workspace Groups YesWorkspace Users Yes

Connection QueryDefs No.UsingtheCreateQueryDefmethodautomaticallyappendsnewobjects.

Connection Recordsets No.UsingtheOpenRecordsetmethodautomaticallyappendsnewobjects.

Database Containers No

Database QueryDefsOnlywhentheQueryDefobjectisanew,unappendedobjectcreatedwithnoname.SeetheCreateQueryDefmethodfordetails.

Page 191: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Database Recordsets No.UsingtheOpenRecordsetmethodautomaticallyappendsnewobjects.

Database Relations YesDatabase TableDefs YesGroup Users YesUser Groups YesContainer Documents NoQueryDef Fields NoQueryDef Parameters NoRecordset Fields NoRelation Fields Yes

TableDef FieldsOnlywhentheUpdatablepropertyoftheTableDefobjectissettoTrue,orwhentheTableDefobjectisunappended.

TableDef IndexesOnlywhentheUpdatablepropertyoftheTableDefissettoTrue,orwhentheTableDefobjectisunappended.

Index Fields OnlywhentheIndexobjectisanew,unappendedobject.

Database,Field,Index,QueryDef,TableDef

PropertiesOnlywhentheDatabase,Field,Index,QueryDef,orTableDefobjectisinaMicrosoftJetworkspace.

DBEngine,Parameter,Recordset,Workspace

Properties No

Page 192: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AppendChunkMethod

AppendsdatafromastringexpressiontoaMemoorLongBinaryFieldobjectinaRecordset.

Syntax

recordset!field.AppendChunksource

TheAppendChunkmethodsyntaxhastheseparts.

Part Description

recordset AnobjectvariablethatrepresentstheRecordsetobjectcontainingtheFieldscollection.

fieldAnobjectvariablethatrepresentsthenameofaFieldobjectwhoseTypepropertyissettodbMemo(Memo),dbLongBinary(LongBinary),ortheequivalent.

source AVariant(Stringsubtype)expressionorvariablecontainingthedatayouwanttoappendtotheFieldobjectspecifiedbyfield.

Remarks

YoucanusetheAppendChunkandGetChunkmethodstoaccesssubsetsofdatainaMemoorLongBinaryfield.

Page 193: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

YoucanalsousethesemethodstoconservestringspacewhenyouworkwithMemoandLongBinaryfields.Certainoperations(copying,forexample)involvetemporarystrings.Ifstringspaceislimited,youmayneedtoworkwithchunksofafieldinsteadoftheentirefield.

IfthereisnocurrentrecordwhenyouuseAppendChunk,anerroroccurs.

Notes

TheinitialAppendChunkoperation(afteranEditorAddNewcall)willsimplyplacethedatainthefield,overwritinganyexistingdata.SubsequentAppendChunkcallswithinthesameEditorAddNewsessionwillthenaddtotheexistingdata.

InanODBCDirectworkspace,unlessyoufirsteditanotherfieldinthecurrentrecord,usingAppendChunkwillfail(thoughnoerroroccurs)whileyouareinEditmode.

InanODBCDirectworkspace,afteryouuseAppendChunkonafield,youcannotreadorwritethatfieldinanassignmentstatementuntilyoumoveoffthecurrentrecordandthenreturntoit.YoucandothisbyusingtheMoveNextandMovePreviousmethods.

Page 194: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

BeginTrans,CommitTrans,RollbackMethods

ThetransactionmethodsmanagetransactionprocessingduringasessiondefinedbyaWorkspaceobjectasfollows:

BeginTransbeginsanewtransaction.

CommitTransendsthecurrenttransactionandsavesthechanges.

RollbackendsthecurrenttransactionandrestoresthedatabasesintheWorkspaceobjecttothestatetheywereinwhenthecurrenttransactionbegan.

Syntax

workspace.BeginTrans|CommitTrans[dbForceOSFlush]|Rollback

TheworkspaceplaceholderisanobjectvariablethatrepresentstheWorkspacecontainingthedatabasesthatwillusetransactions.

Page 195: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Remarks

YouusethesemethodswithaWorkspaceobjectwhenyouwanttotreataseriesofchangesmadetothedatabasesinasessionasoneunit.

Typically,youusetransactionstomaintaintheintegrityofyourdatawhenyoumustbothupdaterecordsintwoormoretablesandensurechangesarecompleted(committed)inalltablesornoneatall(rolledback).Forexample,ifyoutransfermoneyfromoneaccounttoanother,youmightsubtractanamountfromoneandaddtheamounttoanother.Ifeitherupdatefails,theaccountsnolongerbalance.UsetheBeginTransmethodbeforeupdatingthefirstrecord,andthen,ifanysubsequentupdatefails,youcanusetheRollbackmethodtoundoalloftheupdates.UsetheCommitTransmethodafteryousuccessfullyupdatethelastrecord.

InaMicrosoftJetworkspace,youcanincludethedbFlushOSCacheWritesconstantwithCommitTrans,Thisforcesthedatabaseenginetoimmediatelyflushallupdatestodisk,insteadofcachingthemtemporarily.Withoutusingthisoption,ausercouldgetcontrolbackimmediatelyaftertheapplicationprogramcallsCommitTrans,turnthecomputeroff,andnothavethedatawrittentodisk.Whileusingthisoptionmayaffectyourapplication’sperformance,itisusefulinsituationswherethecomputercouldbeshutoffbeforecachedupdatesaresavedtodisk.

CautionWithinoneWorkspaceobject,transactionsarealwaysglobaltotheWorkspaceandaren'tlimitedtoonlyoneConnectionorDatabaseobject.IfyouperformoperationsonmorethanoneconnectionordatabasewithinaWorkspacetransaction,resolvingthetransaction(thatis,usingtheCommitTransorRollbackmethod)affectsalloperationsonallconnectionsanddatabaseswithinthatworkspace.

AfteryouuseCommitTrans,youcan'tundochangesmadeduringthattransactionunlessthetransactionisnestedwithinanothertransactionthatisitselfrolledback.Ifyounesttransactions,youmustresolvethecurrenttransactionbeforeyoucanresolveatransactionatahigherlevel

Page 196: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ofnesting.

Ifyouwanttohavesimultaneoustransactionswithoverlapping,non-nestedscopes,youcancreateadditionalWorkspaceobjectstocontaintheconcurrenttransactions.

IfyoucloseaWorkspaceobjectwithoutresolvinganypendingtransactions,thetransactionsareautomaticallyrolledback.

IfyouusetheCommitTransorRollbackmethodwithoutfirstusingtheBeginTransmethod,anerroroccurs.

SomeISAMdatabasesusedinaMicrosoftJetworkspacemaynotsupporttransactions,inwhichcasetheTransactionspropertyoftheDatabaseobjectorRecordsetobjectisFalse.Tomakesurethedatabasesupportstransactions,checkthevalueoftheTransactionspropertyoftheDatabaseobjectbeforeusingtheBeginTransmethod.IfyouareusingaRecordsetobjectbasedonmorethanonedatabase,checktheTransactionspropertyoftheRecordsetobject.IfaRecordsetisbasedentirelyonMicrosoftJettables,youcanalwaysusetransactions.Recordsetobjectsbasedontablescreatedbyotherdatabaseproducts,however,maynotsupporttransactions.Forexample,youcan'tusetransactionsinaRecordsetbasedonaParadoxtable.Inthiscase,theTransactionspropertyisFalse.IftheDatabaseorRecordsetdoesn'tsupporttransactions,themethodsareignoredandnoerroroccurs.

Youcan'tnesttransactionsifyouareaccessingODBCdatasourcesthroughtheMicrosoftJetdatabaseengine.

Notes

Youcanoftenimprovetheperformanceofyourapplicationbybreakingoperationsthatrequirediskaccessintotransactionblocks.Thisbuffersyouroperationsandmaysignificantlyreducethenumberoftimesadiskisaccessed.

Page 197: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

InaMicrosoftJetworkspace,transactionsareloggedinafilekeptinthedirectoryspecifiedbytheTEMPenvironmentvariableontheworkstation.IfthetransactionlogfileexhauststheavailablestorageonyourTEMPdrive,thedatabaseenginetriggersarun-timeerror.Atthispoint,ifyouuseCommitTrans,anindeterminatenumberofoperationsarecommitted,buttheremaininguncompletedoperationsarelost,andtheoperationhastoberestarted.UsingaRollbackmethodreleasesthetransactionlogandrollsbackalloperationsinthetransaction.

ClosingacloneRecordsetwithinapendingtransactionwillcauseanimplicitRollbackoperation.

Page 198: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CancelMethod

Cancelsexecutionofapendingasynchronousmethodcall(ODBCDirectworkspacesonly).

Syntax

object.Cancel

TheCancelmethodsyntaxhastheseparts.

Part Description

object Astringexpressionthatevaluatestooneoftheobjectsinthe"AppliesTo"list.

Remarks

UsetheCancelmethodtoterminateexecutionofanasynchronousExecute,MoveLast,OpenConnection,orOpenRecordsetmethodcall(thatis,themethodwasinvokedwiththedbRunAsyncoption).Cancelwillreturnarun-timeerrorifdbRunAsyncwasnotusedinthemethodyou'retryingtoterminate.

Thefollowingtableshowswhattaskisterminatedwhenyouusethe

Page 199: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Cancelmethodonaparticulartypeofobject.

Ifobjectisa ThisasynchronousmethodisterminatedConnection ExecuteorOpenConnectionQueryDef ExecuteRecordset MoveLastorOpenRecordset

Anerrorwilloccurif,followingaCancelmethodcall,youtrytoreferencetheobjectthatwouldhavebeencreatedbyanasynchronousOpenConnectionorOpenRecordsetcall(thatis,theConnectionorRecordsetobjectfromwhichyoucalledtheCancelmethod).

Page 200: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CancelUpdateMethod

CancelsanypendingupdatesforaRecordsetobject.

Syntax

recordset.CancelUpdatetype

TheCancelUpdatemethodsyntaxhastheseparts.

Part Description

recordset AnobjectvariablethatrepresentstheRecordsetobjectforwhichyouarecancelingpendingupdates.

type Optional.Aconstantindicatingthetypeofupdate,asspecifiedinSettings.

Settings

Youcanusethefollowingvaluesforthetypeargumentonlyifbatchupdatingisenabled.

Constant Description

dbUpdateRegular Default.Cancelspendingchangesthataren’tcached.

Page 201: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbUpdateBatch Cancelspendingchangesintheupdatecache.

Remarks

YoucanusetheCancelUpdatemethodtocancelanypendingupdatesresultingfromanEditorAddNewoperation.Forexample,ifauserinvokestheEditorAddNewmethodandhasn'tyetinvokedtheUpdatemethod,CancelUpdatecancelsanychangesmadeafterEditorAddNewwasinvoked.

ChecktheEditModepropertyoftheRecordsettodetermineifthereisapendingoperationthatcanbecanceled.

NoteUsingtheCancelUpdatemethodhasthesameeffectasmovingtoanotherrecordwithoutusingtheUpdatemethod,exceptthatthecurrentrecorddoesn'tchange,andvariousproperties,suchasBOFandEOF,aren'tupdated.

Page 202: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CloneMethod

CreatesaduplicateRecordsetobjectthatreferstotheoriginalRecordsetobject.

Syntax

Setduplicate=original.Clone

TheClonemethodsyntaxhastheseparts.

Part Description

duplicate AnobjectvariableidentifyingtheduplicateRecordsetobjectyou'recreating.

original AnobjectvariableidentifyingtheRecordsetobjectyouwanttoduplicate.

Remarks

UsetheClonemethodtocreatemultiple,duplicateRecordsetobjects.EachRecordsetcanhaveitsowncurrentrecord.UsingClonebyitselfdoesn'tchangethedataintheobjectsorintheirunderlyingstructures.WhenyouusetheClonemethod,youcansharebookmarksbetweentwoormoreRecordsetobjectsbecausetheirbookmarksare

Page 203: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

interchangeable.

YoucanusetheClonemethodwhenyouwanttoperformanoperationonaRecordsetthatrequiresmultiplecurrentrecords.ThisisfasterandmoreefficientthanopeningasecondRecordset.WhenyoucreateaRecordsetwiththeClonemethod,itinitiallylacksacurrentrecord.TomakearecordcurrentbeforeyouusetheRecordsetclone,youmustsettheBookmarkpropertyoruseoneoftheMovemethods,oneoftheFindmethods,ortheSeekmethod.

UsingtheClosemethodoneithertheoriginalorduplicateobjectdoesn'taffecttheotherobject.Forexample,usingCloseontheoriginalRecordsetdoesn'tclosetheclone.

Notes

ClosingacloneRecordsetwithinapendingtransactionwillcauseanimplicitRollbackoperation.

Whenyoucloneatable-typeRecordsetobjectinaMicrosoftJetworkspace,theIndexpropertysettingisnotclonedonthenewcopyoftheRecordset.YoumustcopytheIndexpropertysettingmanually.

YoucanusetheClonemethodwithforward-only–typeRecordsetobjectsonlyinanODBCDirectworkspace.

Page 204: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CloseMethod

ClosesanopenDAOobject.

Syntax

object.Close

TheobjectplaceholderisanobjectvariablethatrepresentsanopenConnection,Database,Recordset,orWorkspaceobject.

Remarks

Closinganopenobjectremovesitfromthecollectiontowhichit'sappended.Anyattempttoclosethedefaultworkspaceisignored.

IftheConnection,Database,Recordset,orWorkspaceobjectnamedbyobjectisalreadyclosedwhenyouuseClose,arun-timeerroroccurs.

CautionIfyouexitaprocedurethatdeclaresConnection,Database,orRecordsetobjects,thoseobjectsareclosed,allpendingtransactionsarerolledback,andanypendingeditstoyourdataarelost.

Page 205: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IfyoutrytocloseaConnectionorDatabaseobjectwhileithasanyopenRecordsetobjects,theRecordsetobjectswillbeclosedandanypendingupdatesoreditswillbecanceled.Similarly,ifyoutrytocloseaWorkspaceobjectwhileithasanyopenConnectionorDatabaseobjects,thoseConnectionandDatabaseobjectswillbeclosed,whichwillclosetheirRecordsetobjects.

UsingtheClosemethodoneitheranoriginalorclonedRecordsetobjectdoesn'taffecttheotherRecordsetobject.

ToremoveobjectsfromupdatablecollectionsotherthantheConnections,Databases,Recordsets,andWorkspacescollections,usetheDeletemethodonthosecollections.Youcan'taddanewmembertotheContainers,Documents,andErrorscollections.

AnalternativetotheClosemethodistosetthevalueofanobjectvariabletoNothing(SetdbsTemp=Nothing).

Page 206: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CompactDatabaseMethod

Copiesandcompactsacloseddatabase,andgivesyoutheoptionofchangingitsversion,collatingorder,andencryption.(MicrosoftJetworkspacesonly).

Syntax

DBEngine.CompactDatabaseolddb,newdb,locale,options,password

TheCompactDatabasemethodsyntaxhastheseparts.

Part Description

olddb

AStringthatidentifiesanexisting,closeddatabase.Itcanbeafullpathandfilename,suchas"C:\db1.mdb".Ifthefilenamehasanextension,youmustspecifyit.Ifyournetworksupportsit,youcanalsospecifyanetworkpath,suchas"\\server1\share1\dir1\db1.mdb".

newdbAStringthatisthefilename(andpath)ofthecompacteddatabasethatyou'recreating.Youcanalsospecifyanetworkpath.Youcan'tusethenewdbargumenttospecifythesamedatabasefileasolddb.

localeOptional.AVariantthatisastringexpressionthatspecifiesacollatingorderforcreatingnewdb,asspecifiedinSettings.Ifyouomitthisargument,thelocaleofnewdbisthesameasolddb.

Page 207: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Youcanalsocreateapasswordfornewdbbyconcatenatingthepasswordstring(startingwith";pwd=")withaconstantinthelocaleargument,likethis:dbLangSpanish&";pwd=NewPassword"Ifyouwanttousethesamelocaleasolddb(thedefaultvalue),butspecifyanewpassword,simplyenterapasswordstringforlocale:";pwd=NewPassword"

optionsOptional.Aconstantorcombinationofconstantsthatindicatesoneormoreoptions,asspecifiedinSettings.Youcancombineoptionsbysummingthecorrespondingconstants.

password

Optional.AVariantthatisastringexpressioncontainingapassword,ifthedatabaseispasswordprotected.Thestring";pwd="mustprecedetheactualpassword.Ifyouincludeapasswordsettinginlocale,thissettingisignored.

NoteUsestrongpasswordsthatcombineupper-andlowercaseletters,numbers,andsymbols.Weakpasswordsdon'tmixtheseelements.Strongpassword:Y6dh!et5.Weakpassword:House27.Useastrongpasswordthatyoucanremembersothatyoudon'thavetowriteitdown.

Settings

YoucanuseoneofthefollowingconstantsforthelocaleargumenttospecifytheCollatingOrderpropertyforstringcomparisonsoftext.

Constant Collatingorder

dbLangGeneral English,German,French,Portuguese,Italian,andModernSpanish

dbLangArabic ArabicdbLangChineseSimplified SimplifiedChinesedbLangChineseTraditional TraditionalChinesedbLangCyrillic RussiandbLangCzech CzechdbLangDutch DutchdbLangGreek GreekdbLangHebrew HebrewdbLangHungarian HungariandbLangIcelandic Icelandic

Page 208: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbLangJapanese JapanesedbLangKorean Korean

dbLangNordic Nordiclanguages(MicrosoftJetdatabaseengineversion1.0only)

dbLangNorwDan NorwegianandDanishdbLangPolish PolishdbLangSlovenian SloveniandbLangSpanish TraditionalSpanishdbLangSwedFin SwedishandFinnishdbLangThai ThaidbLangTurkish Turkish

Youcanuseoneofthefollowingconstantsintheoptionsargumenttospecifywhethertoencryptortodecryptthedatabasewhileit'scompacted.

Constant DescriptiondbEncrypt Encryptthedatabasewhilecompacting.dbDecrypt Decryptthedatabasewhilecompacting.

IfyouomitanencryptionconstantorifyouincludebothdbDecryptanddbEncrypt,newdbwillhavethesameencryptionasolddb.

Youcanuseoneofthefollowingconstantsintheoptionsargumenttospecifytheversionofthedataformatforthecompacteddatabase.Thisconstantaffectsonlytheversionofthedataformatofnewdbanddoesn'taffecttheversionofanyMicrosoftAccess-definedobjects,suchasformsandreports.

Constant Description

dbVersion10 CreatesadatabasethatusestheMicrosoftJetdatabaseengineversion1.0fileformatwhilecompacting.

dbVersion11 CreatesadatabasethatusestheMicrosoftJetdatabaseengineversion1.1fileformatwhilecompacting.

dbVersion20 CreatesadatabasethatusestheMicrosoftJetdatabaseengineversion2.0fileformatwhilecompacting.

Page 209: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbVersion30CreatesadatabasethatusestheMicrosoftJetdatabaseengineversion3.0fileformat(compatiblewithversion3.5)whilecompacting.

Youcanspecifyonlyoneversionconstant.Ifyouomitaversionconstant,newdbwillhavethesameversionasolddb.Youcancompactnewdbonlytoaversionthatisthesameorlaterthanthatofolddb.

Remarks

Asyouchangedatainadatabase,thedatabasefilecanbecomefragmentedandusemorediskspacethanisnecessary.Periodically,youcanusetheCompactDatabasemethodtocompactyourdatabasetodefragmentthedatabasefile.Thecompacteddatabaseisusuallysmallerandoftenrunsfaster.Youcanalsochangethecollatingorder,theencryption,ortheversionofthedataformatwhileyoucopyandcompactthedatabase.

Youmustcloseolddbbeforeyoucompactit.Inamultiuserenvironment,otheruserscan'thaveolddbopenwhileyou'recompactingit.Ifolddbisn'tclosedorisn'tavailableforexclusiveuse,anerroroccurs.

BecauseCompactDatabasecreatesacopyofthedatabase,youmusthaveenoughdiskspaceforboththeoriginalandtheduplicatedatabases.Thecompactoperationfailsifthereisn'tenoughdiskspaceavailable.Thenewdbduplicatedatabasedoesn'thavetobeonthesamediskasolddb.Aftersuccessfullycompactingadatabase,youcandeletetheolddbfileandrenamethecompactednewdbfiletotheoriginalfilename.

TheCompactDatabasemethodcopiesallthedataandthesecuritypermissionsettingsfromthedatabasespecifiedbyolddbtothedatabasespecifiedbynewdb.

IfyouuseCompactDatabasetoconvertaversion1.xdatabasetoversion2.5or3.x,onlyapplicationsusingversionMicrosoftJet2.5or3.xcanopentheconverteddatabase.

Page 210: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteInanODBCDirectworkspace,usingtheCompactDatabasemethoddoesn'treturnanerror,butinsteadloadstheMicrosoftJetdatabaseengineintomemory.

CautionBecausetheCompactDatabasemethoddoesn'tconvertMicrosoftAccessobjects,youshouldn'tuseCompactDatabasetoconvertadatabasecontainingsuchobjects.ToconvertadatabasecontainingMicrosoftAccessobjects,ontheToolsmenu,pointtoDatabaseUtilities,andthenclickConvertDatabase.

Page 211: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CopyQueryDefMethod

ReturnsaQueryDefobjectthatisacopyoftheQueryDefusedtocreatetheRecordsetobjectrepresentedbytherecordsetplaceholder(MicrosoftJetworkspacesonly).

Syntax

Setquerydef=recordset.CopyQueryDef

TheCopyQueryDefmethodsyntaxhastheseparts.

Part Description

querydef AnobjectvariablethatrepresentsthecopyofaQueryDefobjectyouwanttocreate.

recordset AnobjectvariablethatrepresentstheRecordsetobjectcreatedwiththeoriginalQueryDefobject.

Remarks

YoucanusetheCopyQueryDefmethodtocreateanewQueryDefthatisaduplicateoftheQueryDefusedtocreatetheRecordset.

IfaQueryDefwasn'tusedtocreatethisRecordset,anerroroccurs.You

Page 212: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

mustfirstopenaRecordsetwiththeOpenRecordsetmethodbeforeusingtheCopyQueryDefmethod.

ThismethodisusefulwhenyoucreateaRecordsetobjectfromaQueryDef,andpasstheRecordsettoafunction,andthefunctionmustre-createtheSQLequivalentofthequery,forexample,tomodifyitinsomeway.

Page 213: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateDatabaseMethod

CreatesanewDatabaseobject,savesthedatabasetodisk,andreturnsanopenedDatabaseobject(MicrosoftJetworkspacesonly).

Syntax

Setdatabase=workspace.CreateDatabase(name,locale,options)

TheCreateDatabasemethodsyntaxhastheseparts.

Part Description

database AnobjectvariablethatrepresentstheDatabaseobjectyouwanttocreate.

workspaceAnobjectvariablethatrepresentstheexistingWorkspaceobjectthatwillcontainthedatabase.Ifyouomitworkspace,CreateDatabaseusesthedefaultWorkspace.

name

AStringupto255characterslongthatisthenameofthedatabasefilethatyou'recreating.Itcanbethefullpathandfilename,suchas"C:\db1.mdb".Ifyoudon'tsupplyafilenameextension,.mdbisappended.Ifyournetworksupportsit,youcanalsospecifyanetworkpath,suchas"\\server1\share1\dir1\db1".Youcanonlycreate.mdbdatabasefileswiththismethod.Astringexpressionthatspecifiesacollatingorderforcreatingthe

Page 214: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

locale database,asspecifiedinSettings.Youmustsupplythisargumentoranerroroccurs.

YoucanalsocreateapasswordforthenewDatabaseobjectbyconcatenatingthepasswordstring(startingwith";pwd=")withaconstantinthelocaleargument,likethis:dbLangSpanish&";pwd=NewPassword"

NoteUsestrongpasswordsthatcombineupper-andlowercaseletters,numbers,andsymbols.Weakpasswordsdon'tmixtheseelements.Strongpassword:Y6dh!et5.Weakpassword:House27.Useastrongpasswordthatyoucanremembersothatyoudon'thavetowriteitdown.

Ifyouwanttousethedefaultlocale,butspecifyapassword,simplyenterapasswordstringforthelocaleargument:";pwd=NewPassword"

NoteUsestrongpasswordsthatcombineupper-andlowercaseletters,numbers,andsymbols.Weakpasswordsdon'tmixtheseelements.Strongpassword:Y6dh!et5.Weakpassword:House27.Useastrongpasswordthatyoucanremembersothatyoudon'thavetowriteitdown.

optionsOptional.Aconstantorcombinationofconstantsthatindicatesoneormoreoptions,asspecifiedinSettings.Youcancombineoptionsbysummingthecorrespondingconstants.

Settings

YoucanuseoneofthefollowingconstantsforthelocaleargumenttospecifytheCollatingOrderpropertyoftextforstringcomparisons.

Constant Collatingorder

dbLangGeneral English,German,French,Portuguese,Italian,andModernSpanish

dbLangArabic ArabicdbLangChineseSimplified SimplifiedChinesedbLangChineseTraditional TraditionalChinesedbLangCyrillic RussiandbLangCzech Czech

Page 215: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbLangDutch DutchdbLangGreek GreekdbLangHebrew HebrewdbLangHungarian HungariandbLangIcelandic IcelandicdbLangJapanese JapanesedbLangKorean Korean

dbLangNordic Nordiclanguages(MicrosoftJetdatabaseengineversion1.0only)

dbLangNorwDan NorwegianandDanishdbLangPolish PolishdbLangSlovenian SloveniandbLangSpanish TraditionalSpanishdbLangSwedFin SwedishandFinnishdbLangThai ThaidbLangTurkish Turkish

Youcanuseoneormoreofthefollowingconstantsintheoptionsargumenttospecifywhichversionthedataformatshouldhaveandwhetherornottoencryptthedatabase.

Constant DescriptiondbEncrypt Createsanencrypteddatabase.

dbVersion10 CreatesadatabasethatusestheMicrosoftJetdatabaseengineversion1.0fileformat.

dbVersion11 CreatesadatabasethatusestheMicrosoftJetdatabaseengineversion1.1fileformat.

dbVersion20 CreatesadatabasethatusestheMicrosoftJetdatabaseengineversion2.0fileformat.

dbVersion30 (Default)CreatesadatabasethatusestheMicrosoftJetdatabaseengineversion3.0fileformat(compatiblewithversion3.5).

Ifyouomittheencryptionconstant,CreateDatabasecreatesanun-encrypteddatabase.Youcanspecifyonlyoneversionconstant.Ifyouomitaversionconstant,CreateDatabasecreatesadatabasethatusestheMicrosoftJetdatabaseengineversion3.0fileformat.

Page 216: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Remarks

UsetheCreateDatabasemethodtocreateandopenanew,emptydatabase,andreturntheDatabaseobject.YoumustcompleteitsstructureandcontentbyusingadditionalDAOobjects.Ifyouwanttomakeapartialorcompletecopyofanexistingdatabase,youcanusetheCompactDatabasemethodtomakeacopythatyoucancustomize.

Page 217: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateFieldMethod

CreatesanewFieldobject(MicrosoftJetworkspacesonly).

Syntax

Setfield=object.CreateField(name,type,size)

TheCreateFieldmethodsyntaxhastheseparts.

Part Description

field AnobjectvariablethatrepresentstheFieldobjectyouwanttocreate.

object AnobjectvariablethatrepresentstheIndex,Relation,orTableDefobjectforwhichyouwanttocreatethenewFieldobject.

nameOptional.AVariant(Stringsubtype)thatuniquelynamesthenewFieldobject.SeetheNamepropertyfordetailsonvalidFieldnames.

type Optional.AconstantthatdeterminesthedatatypeofthenewFieldobject.SeetheTypepropertyforvaliddatatypes.

size

Optional.AVariant(Integersubtype)thatindicatesthemaximumsize,inbytes,ofaFieldobjectthatcontainstext.SeetheSizepropertyforvalidsizevalues.Thisargumentisignoredfornumericandfixed-widthfields.

Page 218: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Remarks

YoucanusetheCreateFieldmethodtocreateanewfield,aswellasspecifythename,datatype,andsizeofthefield.IfyouomitoneormoreoftheoptionalpartswhenyouuseCreateField,youcanuseanappropriateassignmentstatementtosetorresetthecorrespondingpropertybeforeyouappendthenewobjecttoacollection.Afteryouappendthenewobject,youcanaltersomebutnotallofitspropertysettings.Seetheindividualpropertytopicsformoredetails.

ThetypeandsizeargumentsapplyonlytoFieldobjectsinaTableDefobject.TheseargumentsareignoredwhenaFieldobjectisassociatedwithanIndexorRelationobject.

Ifnamereferstoanobjectthatisalreadyamemberofthecollection,arun-timeerroroccurswhenyouusetheAppendmethod.

ToremoveaFieldobjectfromaFieldscollection,usetheDeletemethodonthecollection.Youcan'tdeleteaFieldobjectfromaTableDefobject'sFieldscollectionafteryoucreateanindexthatreferencesthefield.

Page 219: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateGroupMethod

CreatesanewGroupobject(MicrosoftJetworkspacesonly).

Syntax

Setgroup=object.CreateGroup(name,pid)

TheCreateGroupmethodsyntaxhastheseparts.

Part Descriptiongroup AnobjectvariablethatrepresentstheGroupyouwanttocreate.

object AnobjectvariablethatrepresentstheUserorWorkspaceobjectforwhichyouwanttocreatethenewGroupobject.

nameOptional.AVariant(Stringsubtype)thatuniquelynamesthenewGroupobject.SeetheNamepropertyfordetailsonvalidGroupnames.

pid

Optional.AVariant(Stringsubtype)containingthePIDofagroupaccount.Theidentifiermustcontainfrom4to20alphanumericcharacters.SeethePIDpropertyformoreinformationonvalidpersonalidentifiers.

Remarks

Page 220: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

YoucanusetheCreateGroupmethodtocreateanewGroupobjectforaUserorWorkspace.IfyouomitoneorbothoftheoptionalpartswhenyouuseCreateGroup,youcanuseanappropriateassignmentstatementtosetorresetthecorrespondingpropertybeforeyouappendthenewobjecttoacollection.Afteryouappendtheobject,youcanaltersomebutnotallofitspropertysettings.Seetheindividualpropertytopicsformoredetails.

Ifnamereferstoanobjectthatisalreadyamemberofthecollection,arun-timeerroroccurswhenyouusetheAppendmethod.

ToremoveaGroupobjectfromacollection,usetheDeletemethodontheGroupscollection.

Page 221: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateIndexMethod

CreatesanewIndexobject(MicrosoftJetworkspacesonly).

Syntax

Setindex=tabledef.CreateIndex(name)

TheCreateIndexmethodsyntaxhastheseparts.

Part Descriptionindex Anobjectvariablethatrepresentstheindexyouwanttocreate.

tabledef AnobjectvariablethatrepresentstheTableDefobjectyouwanttousetocreatethenewIndexobject.

nameOptional.AVariant(Stringsubtype)thatuniquelynamesthenewIndexobject.SeetheNamepropertyfordetailsonvalidIndexnames.

Remarks

YoucanusetheCreateIndexmethodtocreateanewIndexobjectforaTableDefobject.IfyouomittheoptionalnamepartwhenyouuseCreateIndex,youcanuseanappropriateassignmentstatementtosetorresettheNamepropertybeforeyouappendthenewobjecttoa

Page 222: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

collection.Afteryouappendtheobject,youmayormaynotbeabletosetitsNameproperty,dependingonthetypeofobjectthatcontainstheIndexescollection.SeetheNamepropertytopicformoredetails.

Ifnamereferstoanobjectthatisalreadyamemberofthecollection,arun-timeerroroccurswhenyouusetheAppendmethod.

ToremoveanIndexobjectfromacollection,usetheDeletemethodonthecollection.

Page 223: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreatePropertyMethod

Createsanewuser-definedPropertyobject(MicrosoftJetworkspacesonly).

Syntax

Setproperty=object.CreateProperty(name,type,value,DDL)

TheCreatePropertymethodsyntaxhastheseparts.

Part Description

property AnobjectvariablethatrepresentsthePropertyobjectyouwanttocreate.

objectAnobjectvariablethatrepresentstheDatabase,Field,Index,QueryDef,Document,orTableDefobjectyouwanttousetocreatethenewPropertyobject.

nameOptional.AVariant(Stringsubtype)thatuniquelynamesthenewPropertyobject.SeetheNamepropertyfordetailsonvalidPropertynames.

type Optional.AconstantthatdefinesthedatatypeofthenewPropertyobject.SeetheTypepropertyforvaliddatatypes.

value Optional.AVariantcontainingtheinitialpropertyvalue.SeetheValuepropertyfordetails.

Page 224: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DDLOptional.AVariant(Booleansubtype)thatindicateswhetherornotthePropertyisaDDLobject.ThedefaultisFalse.IfDDLisTrue,userscan'tchangeordeletethisPropertyobjectunlesstheyhavedbSecWriteDefpermission.

Remarks

Youcancreateauser-definedPropertyobjectonlyinthePropertiescollectionofanobjectthatispersistent.

IfyouomitoneormoreoftheoptionalpartswhenyouuseCreateProperty,youcanuseanappropriateassignmentstatementtosetorresetthecorrespondingpropertybeforeyouappendthenewobjecttoacollection.Afteryouappendtheobject,youcanaltersomebutnotallofitspropertysettings.SeetheName,Type,andValuepropertytopicsformoredetails.

Ifnamereferstoanobjectthatisalreadyamemberofthecollection,arun-timeerroroccurswhenyouusetheAppendmethod.

Toremoveauser-definedPropertyobjectfromthecollection,usetheDeletemethodonthePropertiescollection.Youcan'tdeletebuilt-inproperties.

NoteIfyouomittheDDLargument,itdefaultstoFalse(non-DDL).BecausenocorrespondingDDLpropertyisexposed,youmustdeleteandre-createaPropertyobjectyouwanttochangefromDDLtonon-DDL.

Page 225: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateQueryDefMethod

CreatesanewQueryDefobjectinaspecifiedConnectionorDatabaseobject.

Syntax

Setquerydef=object.CreateQueryDef(name,sqltext)

TheCreateQueryDefmethodsyntaxhastheseparts.

Part Description

querydef AnobjectvariablethatrepresentstheQueryDefobjectyouwanttocreate.

object AnobjectvariablethatrepresentsanopenConnectionorDatabaseobjectthatwillcontainthenewQueryDef.

name Optional.AVariant(Stringsubtype)thatuniquelynamesthenewQueryDef.

sqltext

Optional.AVariant(Stringsubtype)thatisanSQLstatementdefiningtheQueryDef.Ifyouomitthisargument,youcandefinetheQueryDefbysettingitsSQLpropertybeforeorafteryouappendittoacollection.

Remarks

Page 226: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

InaMicrosoftJetworkspace,ifyouprovideanythingotherthanazero-lengthstringforthenamewhenyoucreateaQueryDef,theresultingQueryDefobjectisautomaticallyappendedtotheQueryDefscollection.InanODBCDirectworkspace,QueryDefobjectsarealwaystemporary.

InanODBCDirectworkspace,thesqltextargumentcanspecifyanSQLstatementoraMicrosoftSQLServerstoredprocedureanditsparameters.

IftheobjectspecifiedbynameisalreadyamemberoftheQueryDefscollection,arun-timeerroroccurs.YoucancreateatemporaryQueryDefbyusingazero-lengthstringforthenameargumentwhenyouexecutetheCreateQueryDefmethod.YoucanalsoaccomplishthisbysettingtheNamepropertyofanewlycreatedQueryDeftoazero-lengthstring("").TemporaryQueryDefobjectsareusefulifyouwanttorepeatedlyusedynamicSQLstatementswithouthavingtocreateanynewpermanentobjectsintheQueryDefscollection.Youcan'tappendatemporaryQueryDeftoanycollectionbecauseazero-lengthstringisn'tavalidnameforapermanentQueryDefobject.YoucanalwayssettheNameandSQLpropertiesofthenewlycreatedQueryDefobjectandsubsequentlyappendtheQueryDeftotheQueryDefscollection.

ToruntheSQLstatementinaQueryDefobject,usetheExecuteorOpenRecordsetmethod.

UsingaQueryDefobjectisthepreferredwaytoperformSQLpass-throughquerieswithODBCdatabases.

ToremoveaQueryDefobjectfromaQueryDefscollectioninaMicrosoftJetdatabase,usetheDeletemethodonthecollection.ForanODBCDirectdatabase,usetheClosemethodontheQueryDefobject.

Page 227: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateRelationMethod

CreatesanewRelationobject(MicrosoftJetworkspacesonly).

Syntax

Setrelation=database.CreateRelation(name,table,foreigntable,attributes)

TheCreateRelationmethodsyntaxusestheseparts.

Part Description

relation AnobjectvariablethatrepresentstheRelationobjectyouwanttocreate.

database AnobjectvariablethatrepresentstheDatabaseobjectforwhichyouwanttocreatethenewRelationobject.

nameOptional.AVariant(Stringsubtype)thatuniquelynamesthenewRelationobject.SeetheNamepropertyfordetailsonvalidRelationnames.

tableOptional.AVariant(Stringsubtype)thatnamestheprimarytableintherelation.Ifthetabledoesn'texistbeforeyouappendtheRelationobject,arun-timeerroroccurs.

foreigntableOptional.AVariant(Stringsubtype)thatnamestheforeigntableintherelation.Ifthetabledoesn'texistbeforeyouappendtheRelation

Page 228: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

object,arun-timeerroroccurs.

attributesOptional.Aconstantorcombinationofconstantsthatcontainsinformationabouttherelationshiptype.SeetheAttributespropertyfordetails.

Remarks

TheRelationobjectprovidesinformationtotheMicrosoftJetdatabaseengineabouttherelationshipbetweenfieldsintwoTableDeforQueryDefobjects.YoucanimplementreferentialintegritybyusingtheAttributesproperty.

IfyouomitoneormoreoftheoptionalpartswhenyouusetheCreateRelationmethod,youcanuseanappropriateassignmentstatementtosetorresetthecorrespondingpropertybeforeyouappendthenewobjecttoacollection.Afteryouappendtheobject,youcan'talteranyofitspropertysettings.Seetheindividualpropertytopicsformoredetails.

BeforeyoucanusetheAppendmethodonaRelationobject,youmustappendtheappropriateFieldobjectstodefinetheprimaryandforeignkeyrelationshiptables.

IfnamereferstoanobjectthatisalreadyamemberofthecollectionoriftheFieldobjectnamesprovidedinthesubordinateFieldscollectionareinvalid,arun-timeerroroccurswhenyouusetheAppendmethod.

Youcan'testablishormaintainarelationshipbetweenareplicatedtableandalocaltable.

ToremoveaRelationobjectfromtheRelationscollection,usetheDeletemethodonthecollection.

Page 229: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateTableDefMethod

CreatesanewTableDefobject(MicrosoftJetworkspacesonly).

Syntax

Settabledef=database.CreateTableDef(name,attributes,source,connect)

TheCreateTableDefmethodsyntaxhastheseparts.

Part Description

tabledef AnobjectvariablethatrepresentstheTableDefobjectyouwanttocreate.

database AnobjectvariablethatrepresentstheDatabaseobjectyouwanttousetocreatethenewTableDefobject.

nameOptional.AVariant(Stringsubtype)thatuniquelynamesthenewTableDefobject.SeetheNamepropertyfordetailsonvalidTableDefnames.

attributesOptional.AconstantorcombinationofconstantsthatindicatesoneormorecharacteristicsofthenewTableDefobject.SeetheAttributespropertyformoreinformation.

sourceOptional.AVariant(Stringsubtype)containingthenameofatableinanexternaldatabasethatistheoriginalsourceofthedata.

Page 230: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ThesourcestringbecomestheSourceTableNamepropertysettingofthenewTableDefobject.

connect

Optional.AVariant(Stringsubtype)containinginformationaboutthesourceofanopendatabase,adatabaseusedinapass-throughquery,oralinkedtable.SeetheConnectpropertyformoreinformationaboutvalidconnectionstrings.

Remarks

IfyouomitoneormoreoftheoptionalpartswhenyouusetheCreateTableDefmethod,youcanuseanappropriateassignmentstatementtosetorresetthecorrespondingpropertybeforeyouappendthenewobjecttoacollection.Afteryouappendtheobject,youcanaltersomebutnotallofitsproperties.Seetheindividualpropertytopicsformoredetails.

Ifnamereferstoanobjectthatisalreadyamemberofthecollection,oryouspecifyaninvalidpropertyintheTableDeforFieldobjectyou'reappending,arun-timeerroroccurswhenyouusetheAppendmethod.Also,youcan'tappendaTableDefobjecttotheTableDefscollectionuntilyoudefineatleastoneFieldfortheTableDefobject.

ToremoveaTableDefobjectfromtheTableDefscollection,usetheDeletemethodonthecollection.

Page 231: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateUserMethod

CreatesanewUserobject(MicrosoftJetworkspacesonly).

Syntax

Setuser=object.CreateUser(name,pid,password)

TheCreateUsermethodsyntaxhastheseparts.

Part Descriptionuser AnobjectvariablethatrepresentstheUserobjectyouwanttocreate.

object AnobjectvariablethatrepresentstheGrouporWorkspaceobjectforwhichyouwanttocreatethenewUserobject.

name Optional.AVariant(Stringsubtype)thatuniquelynamesthenewUserobject.SeetheNamepropertyfordetailsonvalidUsernames.

pid

Optional.AVariant(Stringsubtype)containingthePIDofauseraccount.Theidentifiermustcontainfrom4to20alphanumericcharacters.SeethePIDpropertyformoreinformationonvalidpersonalidentifiers.Optional.AVariant(Stringsubtype)containingthepasswordforthenewUserobject.Thepasswordcanbeupto14characterslongandcanincludeanycharactersexcepttheASCIIcharacter0(null).SeethePasswordpropertyformoreinformationonvalidpasswords.

Page 232: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

password NoteUsestrongpasswordsthatcombineupper-andlowercaseletters,numbers,andsymbols.Weakpasswordsdon'tmixtheseelements.Strongpassword:Y6dh!et5.Weakpassword:House27.Useastrongpasswordthatyoucanremembersothatyoudon'thavetowriteitdown.

Remarks

IfyouomitoneormoreoftheoptionalpartswhenyouusetheCreateUsermethod,youcanuseanappropriateassignmentstatementtosetorresetthecorrespondingpropertybeforeyouappendthenewobjecttoacollection.Afteryouappendtheobject,youcanaltersomebutnotallofitspropertysettings.SeethePID,Name,andPasswordpropertytopicsformoredetails.

Ifnamereferstoanobjectthatisalreadyamemberofthecollection,arun-timeerroroccurswhenyouusetheAppendmethod.

ToremoveaUserobjectfromtheUserscollection,usetheDeletemethodonthecollection.

Page 233: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CreateWorkspaceMethod

CreatesanewWorkspaceobject.

Syntax

Setworkspace=CreateWorkspace(name,user,password,type)

TheCreateWorkspacemethodsyntaxhastheseparts.

Part Description

workspace AnobjectvariablethatrepresentstheWorkspaceobjectyouwanttocreate.

name AStringthatuniquelynamesthenewWorkspaceobject.SeetheNamepropertyfordetailsonvalidWorkspacenames.

user AStringthatidentifiestheownerofthenewWorkspaceobject.SeetheUserNamepropertyformoreinformation.

password

AStringcontainingthepasswordforthenewWorkspaceobject.Thepasswordcanbeupto14characterslongandcanincludeanycharactersexceptASCIIcharacter0(null).SeethePasswordpropertyformoreinformationonvalidpasswords.

NoteUsestrongpasswordsthatcombineupper-and

Page 234: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

lowercaseletters,numbers,andsymbols.Weakpasswordsdon'tmixtheseelements.Strongpassword:Y6dh!et5.Weakpassword:House27.Useastrongpasswordthatyoucanremembersothatyoudon'thavetowriteitdown.

type Optional.Aconstantthatindicatesthetypeofworkspace,asdescribedinSettings.

Settings

Youcanusethefollowingconstantsfortype.

Constant DescriptiondbUseJet CreatesaMicrosoftJetworkspace.

dbUseODBC CreatesanODBCDirectworkspace.

Remarks

OnceyouusetheCreateWorkspacemethodtocreateanewWorkspaceobject,aWorkspacesessionisstarted,andyoucanrefertotheWorkspaceobjectinyourapplication.

Workspaceobjectsaren'tpermanent,andyoucan'tsavethemtodisk.OnceyoucreateaWorkspaceobject,youcan'talteranyofitspropertysettings,exceptfortheNameproperty,whichyoucanmodifybeforeappendingtheWorkspaceobjecttotheWorkspacescollection.

Youdon'thavetoappendthenewWorkspaceobjecttoacollectionbeforeyoucanuseit.YouappendanewlycreatedWorkspaceobjectonlyifyouneedtorefertoitthroughtheWorkspacescollection.

ThetypeoptiondetermineswhetherthenewWorkspaceisaMicrosoftJetorODBCDirectworkspace.IfyousettypetodbUseODBCandyouhaven'talreadycreatedanyMicrosoftJetworkspaces,thentheMicrosoftJetdatabaseenginewillnotbeloadedintomemory,andallactivitywilloccurwiththeODBCdatasourcesubsequentlyidentifiedinaConnection

Page 235: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

object.Ifyouomittype,theDefaultTypepropertyofDBEnginewilldeterminewhichtypeofdatasourcetheWorkspaceisconnectedto.YoucanhavebothMicrosoftJetandODBCDirectworkspacesopenatthesametime.

ToremoveaWorkspaceobjectfromtheWorkspacescollection,closeallopendatabasesandconnectionsandthenusetheClosemethodontheWorkspaceobject.

Page 236: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DeleteMethod

Recordsetobjects—deletesthecurrentrecordinanupdatableRecordsetobject.ForODBCDirectworkspaces,thetypeofdriverdetermineswhetherRecordsetobjectsareupdatableandthereforesupporttheDeletemethod.

Collections—deletesapersistentobjectfromacollection.

Syntax

recordset.Delete

collection.Deleteobjectname

TheDeletemethodsyntaxhastheseparts.

Part Description

recordset AnobjectvariablethatrepresentsanupdatableRecordsetobjectcontainingtherecordyouwanttodelete.

collection Anobjectvariablethatrepresentsacollectionfromwhichyouaredeletingobjectname.

Page 237: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

objectname AStringthatistheNamepropertysettingofanobjectincollection.

Remarks

YoucanusetheDeletemethodtodeleteacurrentrecordfromaRecordsetoramemberfromacollection,suchasastoredtablefromadatabase,astoredfieldfromatable,orastoredindexfromatable.

Recordsets

ARecordsetmustcontainacurrentrecordbeforeyouuseDelete;otherwise,arun-timeerroroccurs.

InanupdatableRecordsetobject,Deleteremovesthecurrentrecordandmakesitinaccessible.Althoughyoucan'teditorusethedeletedrecord,itremainscurrent.Onceyoumovetoanotherrecord,however,youcan'tmakethedeletedrecordcurrentagain.SubsequentreferencestoadeletedrecordinaRecordsetareinvalidandproduceanerror.

YoucanundoarecorddeletionifyouusetransactionsandtheRollbackmethod.

Ifthebasetableistheprimarytableinacascadingdeleterelationship,deletingthecurrentrecordmayalsodeleteoneormorerecordsinaforeigntable.

NoteToadd,edit,ordeletearecord,theremustbeauniqueindexontherecordintheunderlyingdatasource.Ifnot,a"Permissiondenied"errorwilloccurontheAddNew,Delete,orEditmethodcallinaMicrosoftJetworkspace,oran"Invalidargument"errorwilloccurontheUpdatemethodcallinanODBCDirectworkspace.

Collections

YoucanusetheDeletemethodtodeleteapersistentobject.However,ifthecollectionisaDatabases,Recordsets,orWorkspacescollection(eachofwhichisstoredonlyinmemory),youcanremoveanopenor

Page 238: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

activeobjectonlybyclosingthatobjectwiththeClosemethod.

Thedeletionofastoredobjectoccursimmediately,butyoushouldusetheRefreshmethodonanyothercollectionsthatmaybeaffectedbychangestothedatabasestructure.

WhenyoudeleteaTableDefobjectfromtheTableDefscollection,youdeletethetabledefinitionandthedatainthetable.

ThefollowingtablelistssomelimitationsoftheDeletemethod.Theobjectinthefirstcolumncontainsthecollectioninthesecondcolumn.Thethirdcolumnindicatesifyoucandeleteanobjectfromthatcollection(forexample,youcanneverdeleteaContainerobjectfromtheContainerscollectionofaDatabaseobject).

Object Collection CanyouusetheDeletemethod?

DBEngine Workspaces No.Closingtheobjectsdeletesthem.

DBEngine Errors No

Workspace Connections No.Closingtheobjectsdeletesthem.

Workspace Databases No.Closingtheobjectsdeletesthem.

Workspace Groups YesWorkspace Users YesConnection QueryDefs No

Connection Recordsets No.Closingtheobjectsdeletesthem.

Database Containers NoDatabase QueryDefs Yes

Database Recordsets No.Closingtheobjectsdeletesthem.

Database Relations YesDatabase TableDefs YesGroup Users YesUser Groups YesContainer Documents NoQueryDef Fields No

Page 239: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

QueryDef Parameters NoRecordset Fields No

Relation Fields OnlywhentheRelationobjectisanew,unappendedobject.

TableDef Fields

OnlywhentheTableDefobjectisnewandhasn’tbeenappendedtothedatabase,orwhentheUpdatablepropertyoftheTableDefissettoTrue.

TableDef Indexes

OnlywhentheTableDefobjectisnewandhasn’tbeenappendedtothedatabase,orwhentheUpdatablepropertyoftheTableDefissettoTrue.

Index FieldsOnlywhentheIndexobjectisnewandhasn’tbeenappendedtothedatabase.

Database,Field,Index,QueryDef,TableDef Properties Onlywhenthepropertyisuser-

defined.DBEngine,Parameter,Recordset,Workspace Properties No

Page 240: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

EditMethod

CopiesthecurrentrecordfromanupdatableRecordsetobjecttothecopybufferforsubsequentediting.

Syntax

recordset.Edit

Therecordsetplaceholderrepresentsanopen,updatableRecordsetobjectthatcontainstherecordyouwanttoedit.

Remarks

OnceyouusetheEditmethod,changesmadetothecurrentrecord'sfieldsarecopiedtothecopybuffer.Afteryoumakethedesiredchangestotherecord,usetheUpdatemethodtosaveyourchanges.

ThecurrentrecordremainscurrentafteryouuseEdit.

CautionIfyoueditarecordandthenperformanyoperationthatmovestoanotherrecord,butwithoutfirstusingUpdate,yourchangesarelostwithoutwarning.Inaddition,ifyoucloserecordsetorendthe

Page 241: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

procedurewhichdeclarestheRecordsetortheparentDatabaseorConnectionobject,youreditedrecordisdiscardedwithoutwarning.

UsingEditproducesanerrorif:

Thereisnocurrentrecord.

TheConnection,Database,orRecordsetobjectwasopenedasread-only.

Nofieldsintherecordareupdatable.

TheDatabaseorRecordsetwasopenedforexclusiveusebyanotheruser(MicrosoftJetworkspace).

Anotheruserhaslockedthepagecontainingyourrecord(MicrosoftJetworkspace).

InaMicrosoftJetworkspace,whentheRecordsetobject'sLockEditspropertysettingisTrue(pessimisticallylocked)inamultiuserenvironment,therecordremainslockedfromthetimeEditisuseduntiltheupdateiscomplete.IftheLockEditspropertysettingisFalse(optimisticallylocked),therecordislockedandcomparedwiththepre-editedrecordjustbeforeit'supdatedinthedatabase.IftherecordhaschangedsinceyouusedtheEditmethod,theUpdateoperationfailswitharun-timeerrorifyouuseOpenRecordsetwithoutspecifyingdbSeeChanges.Bydefault,MicrosoftJet-connectedODBCandinstallableISAMdatabasesalwaysuseoptimisticlocking.

InanODBCDirectworkspace,onceyouedit(anduseUpdatetoupdate)arecord’sprimarykeyfield,youcannolongereditfieldsinthatrecorduntilyouclosetheRecordset,andthenretrievetherecordagaininasubsequentquery.

Page 242: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteToadd,edit,ordeletearecord,theremustbeauniqueindexontherecordintheunderlyingdatasource.Ifnot,a"Permissiondenied"errorwilloccurontheAddNew,Delete,orEditmethodcallinaMicrosoftJetworkspace,oran"Invalidargument"errorwilloccurontheUpdatecallinanODBCDirectworkspace.

Page 243: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ExecuteMethod

RunsanactionqueryorexecutesanSQLstatementonaspecifiedConnectionorDatabaseobject.

Syntax

object.Executesource,options

querydef.Executeoptions

TheExecutemethodsyntaxhastheseparts.

Part Description

object AConnectionorDatabaseobjectvariableonwhichthequerywillrun.

querydef AnobjectvariablethatrepresentstheQueryDefobjectwhoseSQLpropertysettingspecifiestheSQLstatementtoexecute.

source AStringthatisanSQLstatementortheNamepropertyvalueofaQueryDefobject.

optionsOptional.Aconstantorcombinationofconstantsthatdeterminesthedataintegritycharacteristicsofthequery,asspecifiedinSettings.

Page 244: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Settings

Youcanusethefollowingconstantsforoptions.

Constant Description

dbDenyWrite Denieswritepermissiontootherusers(MicrosoftJetworkspacesonly).

dbInconsistent (Default)Executesinconsistentupdates(MicrosoftJetworkspacesonly).

dbConsistent Executesconsistentupdates(MicrosoftJetworkspacesonly).

dbSQLPassThroughExecutesanSQLpass-throughquery.SettingthisoptionpassestheSQLstatementtoanODBCdatabaseforprocessing(MicrosoftJetworkspacesonly).

dbFailOnError Rollsbackupdatesifanerroroccurs(MicrosoftJetworkspacesonly).

dbSeeChanges Generatesarun-timeerrorifanotheruserischangingdatayouareediting(MicrosoftJetworkspacesonly).

dbRunAsync Executesthequeryasynchronously(ODBCDirectConnectionandQueryDefobjectsonly).

dbExecDirectExecutesthestatementwithoutfirstcallingSQLPrepareODBCAPIfunction(ODBCDirectConnectionandQueryDefobjectsonly).

NoteTheconstantsdbConsistentanddbInconsistentaremutuallyexclusive.Youcanuseoneortheother,butnotbothinagiveninstanceofOpenRecordset.UsingbothdbConsistentanddbInconsistentcausesanerror.

Remarks

TheExecutemethodisvalidonlyforactionqueries.IfyouuseExecutewithanothertypeofquery,anerroroccurs.Becauseanactionquerydoesn'treturnanyrecords,Executedoesn'treturnaRecordset.(ExecutinganSQLpass-throughqueryinanODBCDirectworkspacewillnotreturnanerrorifaRecordsetisn'treturned.)

UsetheRecordsAffectedpropertyoftheConnection,Database,or

Page 245: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

QueryDefobjecttodeterminethenumberofrecordsaffectedbythemostrecentExecutemethod.Forexample,RecordsAffectedcontainsthenumberofrecordsdeleted,updated,orinsertedwhenexecutinganactionquery.WhenyouusetheExecutemethodtorunaquery,theRecordsAffectedpropertyoftheQueryDefobjectissettothenumberofrecordsaffected.

InaMicrosoftJetworkspace,ifyouprovideasyntacticallycorrectSQLstatementandhavetheappropriatepermissions,theExecutemethodwon'tfail—evenifnotasinglerowcanbemodifiedordeleted.Therefore,alwaysusethedbFailOnErroroptionwhenusingtheExecutemethodtorunanupdateordeletequery.Thisoptiongeneratesarun-timeerrorandrollsbackallsuccessfulchangesifanyoftherecordsaffectedarelockedandcan'tbeupdatedordeleted.

InearlierversionsoftheMicrosoftJetDatabaseEngine,SQLstatementswereautomaticallyembeddedinimplicittransactions.IfpartofastatementexecutedwithdbFailOnErrorfailed,theentirestatementwouldberolledback.Toimproveperformance,theseimplicittransactionswereremovedstartingwithversion3.5.IfyouareupdatingolderDAOcode,besuretoconsiderusingexplicittransactionsaroundExecutestatements.

ForbestperformanceinaMicrosoftJetworkspace,especiallyinamultiuserenvironment,nesttheExecutemethodinsideatransaction.UsetheBeginTransmethodonthecurrentWorkspaceobject,thenusetheExecutemethod,andcompletethetransactionbyusingtheCommitTransmethodontheWorkspace.Thissaveschangesondiskandfreesanylocksplacedwhilethequeryisrunning.

InanODBCDirectworkspace,ifyouincludetheoptionaldbRunAsyncconstant,thequeryrunsasynchronously.Todeterminewhetheranasynchronousqueryisstillexecuting,checkthevalueoftheStillExecutingpropertyontheobjectfromwhichtheExecutemethodwascalled.ToterminateexecutionofanasynchronousExecutemethodcall,usetheCancelmethod.

ForODBCDirect,usesinglequotestosignifystringsoranerrorwillbe

Page 246: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

returned.

Page 247: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

FillCacheMethod

FillsallorapartofalocalcacheforaRecordsetobjectthatcontainsdatafromaMicrosoftJet-connectedODBCdatasource(MicrosoftJet-connectedODBCdatabasesonly).

Syntax

recordset.FillCacherows,startbookmark

TheFillCachemethodsyntaxhastheseparts.

Part Description

recordsetAnobjectvariablethatrepresentsaRecordsetobjectcreatedfromanODBCdatasource,suchasaTableDefrepresentingalinkedtableoraQueryDefobjectderivedfromsuchaTableDef.

rowsOptional.AVariant(Integersubtype)thatspecifiesthenumberofrowstostoreinthecache.Ifyouomitthisargument,thevalueisdeterminedbytheCacheSizepropertysetting.

startbookmark

Optional.AVariant(Stringsubtype)thatspecifiesabookmark.Thecacheisfilledstartingfromtherecordindicatedbythisbookmark.Ifyouomitthisargument,thecacheisfilledstartingfromtherecordindicatedbytheCacheStartproperty.

Page 248: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Remarks

Cachingimprovestheperformanceofanapplicationthatretrievesdatafromaremoteserver.Acacheisspaceinlocalmemorythatholdsthedatamostrecentlyretrievedfromtheserver;thisassumesthatthedatawillprobablyberequestedagainwhiletheapplicationisrunning.Whenauserrequestsdata,theMicrosoftJetdatabaseenginechecksthecacheforthedatafirstratherthanretrievingitfromtheserver,whichtakesmoretime.Thecachedoesn'tsavedatathatdoesn'tcomefromanODBCdatasource.

Ratherthanwaitingforthecachetobefilledwithrecordsastheyareretrieved,youcanusetheFillCachemethodtoexplicitlyfillthecacheatanytime.ThisisafasterwaytofillthecachebecauseFillCacheretrievesseveralrecordsatonceinsteadofoneatatime.Forexample,whileyouvieweachscreenfulofrecords,yourapplicationusesFillCachetoretrievethenextscreenfulofrecordsforviewing.

AnyMicrosoftJet-connectedODBCdatasourcethatyouaccesswithRecordsetobjectscanhavealocalcache.Tocreatethecache,openaRecordsetobjectfromtheremotedatasource,andthensettheCacheSizeandCacheStartpropertiesoftheRecordset.

IfrowsandstartbookmarkcreatearangeofrecordsthatispartiallyorentirelyoutsidetherangeofrecordsspecifiedbytheCacheSizeandCacheStartproperties,theportionoftherecordsetoutsidethisrangeisignoredandwillnotbeloadedintothecache.

IfFillCacherequestsmorerecordsthanthenumberremainingintheremotedatasource,MicrosoftJetretrievesonlytheremainingrecords,andnoerroroccurs.

Notes

Recordsretrievedfromthecachedon'treflectconcurrentchangesthatotherusersmadetothesourcedata.

Page 249: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

FillCacheonlyretrievesrecordsnotalreadycached.Toforceanupdateofallthecacheddata,settheCacheSizepropertyoftheRecordsetto0,resetittothesizeofthecacheyouoriginallyrequested,andthenuseFillCache.

Page 250: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

FindFirst,FindLast,FindNext,FindPreviousMethods

Locatesthefirst,last,next,orpreviousrecordinadynaset-orsnapshot-typeRecordsetobjectthatsatisfiesthespecifiedcriteriaandmakesthatrecordthecurrentrecord(MicrosoftJetworkspacesonly).

Syntax

recordset.{FindFirst|FindLast|FindNext|FindPrevious}criteria

TheFindmethodshavetheseparts.

Part Description

recordset Anobjectvariablethatrepresentsanexistingdynaset-orsnapshot-typeRecordsetobject.

criteria AStringusedtolocatetherecord.ItisliketheWHEREclauseinanSQLstatement,butwithoutthewordWHERE.

Remarks

Ifyouwanttoincludealltherecordsinyoursearch—notjustthosethatmeetaspecificcondition—usetheMovemethodstomovefromrecord

Page 251: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

torecord.Tolocatearecordinatable-typeRecordset,usetheSeekmethod.

Ifarecordmatchingthecriteriaisn'tlocated,thecurrentrecordpointerisunknown,andtheNoMatchpropertyissettoTrue.Ifrecordsetcontainsmorethanonerecordthatsatisfiesthecriteria,FindFirstlocatesthefirstoccurrence,FindNextlocatesthenextoccurrence,andsoon.

EachoftheFindmethodsbeginsitssearchfromthelocationandinthedirectionspecifiedinthefollowingtable.

Findmethod Beginssearchingat SearchdirectionFindFirst BeginningofrecordsetEndofrecordset

FindLast Endofrecordset Beginningofrecordset

FindNext Currentrecord Endofrecordset

FindPrevious Currentrecord Beginningofrecordset

WhenyouusetheFindLastmethod,theMicrosoftJetdatabaseenginefullypopulatesyourRecordsetbeforebeginningthesearch,ifthishasn'talreadyhappened.

UsingoneoftheFindmethodsisn'tthesameasusingaMovemethod,however,whichsimplymakesthefirst,last,next,orpreviousrecordcurrentwithoutspecifyingacondition.YoucanfollowaFindoperationwithaMoveoperation.

AlwayscheckthevalueoftheNoMatchpropertytodeterminewhethertheFindoperationhassucceeded.Ifthesearchsucceeds,NoMatchisFalse.Ifitfails,NoMatchisTrueandthecurrentrecordisn'tdefined.Inthiscase,youmustpositionthecurrentrecordpointerbacktoavalidrecord.

UsingtheFindmethodswithMicrosoftJet-connectedODBC-accessedrecordsetscanbeinefficient.Youmayfindthatrephrasingyourcriteriatolocateaspecificrecordisfaster,especiallywhenworkingwithlarge

Page 252: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

recordsets.

InanODBCDirectworkspace,theFindandSeekmethodsarenotavailableonanytypeofRecordsetobject,becauseexecutingaFindorSeekthroughanODBCconnectionisnotveryefficientoverthenetwork.Instead,youshoulddesignthequery(thatis,usingthesourceargumenttotheOpenRecordsetmethod)withanappropriateWHEREclausethatrestrictsthereturnedrecordstoonlythosethatmeetthecriteriayouwouldotherwiseuseinaFindorSeekmethod.

WhenworkingwithMicrosoftJet-connectedODBCdatabasesandlargedynaset-typeRecordsetobjects,youmightdiscoverthatusingtheFindmethodsorusingtheSortorFilterpropertyisslow.Toimproveperformance,useSQLquerieswithcustomizedORDERBYorWHEREclauses,parameterqueries,orQueryDefobjectsthatretrievespecificindexedrecords.

YoushouldusetheU.S.dateformat(month-day-year)whenyousearchforfieldscontainingdates,evenifyou'renotusingtheU.S.versionoftheMicrosoftJetdatabaseengine;otherwise,thedatamaynotbefound.UsetheVisualBasicFormatfunctiontoconvertthedate.Forexample:

rstEmployees.FindFirst"HireDate>#"_&Format(mydate,'m-d-yy')&"#"

Ifcriteriaiscomposedofastringconcatenatedwithanon-integervalue,andthesystemparametersspecifyanon-U.S.decimalcharactersuchasacomma(forexample,strSQL="PRICE>"&lngPrice,andlngPrice=125,50),anerroroccurswhenyoutrytocallthemethod.Thisisbecauseduringconcatenation,thenumberwillbeconvertedtoastringusingyoursystem'sdefaultdecimalcharacter,andMicrosoftJetSQLonlyacceptsU.S.decimalcharacters.

Notes

Forbestperformance,thecriteriashouldbeineithertheform"field=value"wherefieldisanindexedfieldintheunderlying

Page 253: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

basetable,or"fieldLIKEprefix"wherefieldisanindexedfieldintheunderlyingbasetableandprefixisaprefixsearchstring(forexample,"ART*").

Ingeneral,forequivalenttypesofsearches,theSeekmethodprovidesbetterperformancethantheFindmethods.Thisassumesthattable-typeRecordsetobjectsalonecansatisfyyourneeds.

Page 254: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

GetChunkMethod

ReturnsalloraportionofthecontentsofaMemoorLongBinaryFieldobjectintheFieldscollectionofaRecordsetobject.

Syntax

Setvariable=recordset!field.GetChunk(offset,numbytes)

TheGetChunkmethodsyntaxhastheseparts.

Part Description

variable AVariant(Stringsubtype)thatreceivesthedatafromtheFieldobjectnamedbyfield.

recordset AnobjectvariablethatrepresentstheRecordsetobjectcontainingtheFieldscollection.

fieldAnobjectvariablethatrepresentsaFieldobjectwhoseTypepropertyissettodbMemo(Memo)ordbLongBinary(LongBinary).

offset ALongvalueequaltothenumberofbytestoskipbeforecopyingbegins.

numbytes ALongvalueequaltothenumberofbytesyouwanttoreturn.

Remarks

Page 255: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ThebytesreturnedbyGetChunkareassignedtovariable.UseGetChunktoreturnaportionofthetotaldatavalueatatime.YoucanusetheAppendChunkmethodtoreassemblethepieces.

Ifoffsetis0,GetChunkbeginscopyingfromthefirstbyteofthefield.

Ifnumbytesisgreaterthanthenumberofbytesinthefield,GetChunkreturnstheactualnumberofremainingbytesinthefield.

CautionUseaMemofieldfortext,andputbinarydataonlyinLongBinaryfields.Doingotherwisewillcauseundesirableresults.

Page 256: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

GetRowsMethod

RetrievesmultiplerowsfromaRecordsetobject.

Syntax

SetvarArray=recordset.GetRows(numrows)

TheGetRowsmethodsyntaxhasthefollowingparts.

Part DescriptionvarArray AVariantthatstoresthereturneddata.recordset AnobjectvariablethatrepresentsaRecordsetobject.

numrows AVariantthatisequaltothenumberofrowstoretrieve.

Remarks

UsetheGetRowsmethodtocopyrecordsfromaRecordset.GetRowsreturnsatwo-dimensionalarray.Thefirstsubscriptidentifiesthefieldandthesecondidentifiestherownumber.Forexample,intFieldrepresentsthefield,andintRecordidentifiestherownumber:

Page 257: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

avarRecords(intField,intRecord)

Togetthefirstfieldvalueinthesecondrowreturned,usecodelikethefollowing:

field1=avarRecords(0,1)

Togetthesecondfieldvalueinthefirstrow,usecodelikethefollowing:

field2=avarRecords(1,0)

TheavarRecordsvariableautomaticallybecomesatwo-dimensionalarraywhenGetRowsreturnsdata.

Ifyourequestmorerowsthanareavailable,thenGetRowsreturnsonlythenumberofavailablerows.YoucanusetheVisualBasicforApplicationsUBoundfunctiontodeterminehowmanyrowsGetRowsactuallyretrieved,becausethearrayissizedtofitthenumberofreturnedrows.Forexample,ifyoureturnedtheresultsintoaVariantcalledvarA,youcouldusethefollowingcodetodeterminehowmanyrowswereactuallyreturned:

numReturned=UBound(varA,2)+1

Youneedtouse"+1"becausethefirstrowreturnedisinthe0elementofthearray.Thenumberofrowsthatyoucanretrieveisconstrainedbytheamountofavailablememory.Youshouldn'tuseGetRowstoretrieveanentiretableintoanarrayifitislarge.

BecauseGetRowsreturnsallfieldsoftheRecordsetintothearray,includingMemoandLongBinaryfields,youmightwanttouseaquerythatrestrictsthefieldsreturned.

AfteryoucallGetRows,thecurrentrecordispositionedatthenextunreadrow.Thatis,GetRowshasthesameeffectonthecurrentrecordasMovenumrows.

IfyouaretryingtoretrievealltherowsbyusingmultipleGetRowscalls,

Page 258: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

usetheEOFpropertytobesurethatyou'reattheendoftheRecordset.GetRowsreturnslessthanthenumberrequestedifit'sattheendoftheRecordset,orifitcan'tretrievearowintherangerequested.Forexample,ifyou'retryingtoretrieve10records,butyoucan'tretrievethefifthrecord,GetRowsreturnsfourrecordsandmakesthefifthrecordthecurrentrecord.Thiswillnotgeneratearun-timeerror.Thismightoccurifanotheruserdeletesarecordinadynaset-typeRecordset.Seetheexampleforademonstrationofhowtohandlethis.

Page 259: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IdleMethod

Suspendsdataprocessing,enablingtheMicrosoftJetdatabaseenginetocompleteanypendingtasks,suchasmemoryoptimizationorpagetimeouts(MicrosoftJetworkspacesonly).

Syntax

DBEngine.Idle[dbRefreshCache]

Remarks

TheIdlemethodallowstheMicrosoftJetdatabaseenginetoperformbackgroundtasksthatmaynotbeup-to-datebecauseofintensedataprocessing.Thisisoftentrueinmultiuser,multitaskingenvironmentsthatdon'thaveenoughbackgroundprocessingtimetokeepallrecordsinaRecordsetcurrent.

Usually,readlocksareremovedanddatainlocaldynaset-typeRecordsetobjectsareupdatedonlywhennootheractions(includingmousemovements)occur.IfyouperiodicallyusetheIdlemethod,MicrosoftJetcancatchuponbackgroundprocessingtasksbyreleasingunneededreadlocks.

Page 260: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SpecifyingtheoptionaldbRefreshCacheargumentrefreshesmemorywithonlythemostcurrentdatafromthe.mdbfile.ThedbForceOSFlushargumentforcespendingwritesto.mdbfilesaspartoftheCommitTransmethod.

Youdon'tneedtousethismethodinsingle-userenvironmentsunlessmultipleinstancesofanapplicationarerunning.TheIdlemethodmayincreaseperformanceinamultiuserenvironmentbecauseitforcesthedatabaseenginetowritedatatodisk,releasinglocksonmemory.

NoteYoucanalsoreleasereadlocksbymakingoperationspartofatransaction.

Page 261: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MakeReplicaMethod

Makesanewreplicafromanotherdatabasereplica(MicrosoftJetworkspacesonly).

Syntax

database.MakeReplicareplica,description,options

TheMakeReplicamethodsyntaxhasthefollowingparts.

Part Description

database AnobjectvariablethatrepresentsanexistingDatabasethatisareplica.

replica AStringthatisthepathandfilenameofthenewreplica.Ifreplicaisanexistingfilename,thenanerroroccurs.

description AStringthatdescribesthereplicathatyouarecreating.

optionsOptional.Aconstantorcombinationofconstantsthatspecifiescharacteristicsofthereplicayouarecreating,asspecifiedinSettings.

Settings

Youcanuseoneormoreofthefollowingconstantsintheoptions

Page 262: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

argument.

Constant DescriptiondbRepMakePartial Createsapartialreplica.

dbRepMakeReadOnly

Preventsusersfrommodifyingthereplicableobjectsofthenewreplica;however,whenyousynchronizethenewreplicawithanothermemberofthereplicaset,designanddatachangeswillbepropagatedtothenewreplica.

Remarks

AnewlycreatedpartialreplicawillhaveallReplicaFilterpropertiessettoFalse,meaningthatnodatawillbeinthetables.

Page 263: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MoveMethod

MovesthepositionofthecurrentrecordinaRecordsetobject.

Syntax

recordset.Moverows,start

TheMovemethodsyntaxhastheseparts.

Part Description

recordset AnobjectvariablethatrepresentstheRecordsetobjectwhosecurrentrecordpositionisbeingmoved.

rows

AsignedLongvaluespecifyingthenumberofrowsthepositionwillmove.Ifrowsisgreaterthan0,thepositionismovedforward(towardtheendofthefile).Ifrowsislessthan0,thepositionismovedbackward(towardthebeginningofthefile).

startbookmarkOptional.AVariant(Stringsubtype)valueidentifyingabookmark.Ifyouspecifystartbookmark,themovebeginsrelativetothisbookmark.Otherwise,Movebeginsfromthecurrentrecord.

Remarks

IfyouuseMovetopositionthecurrentrecordpointerbeforethefirst

Page 264: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

record,thecurrentrecordpointermovestothebeginningofthefile.IftheRecordsetcontainsnorecordsanditsBOFpropertyisTrue,usingthismethodtomovebackwardcausesanerror.

IfyouuseMovetopositionthecurrentrecordpointerafterthelastrecord,thecurrentrecordpointerpositionmovestotheendofthefile.IftheRecordsetcontainsnorecordsanditsEOFpropertyisTrue,thenusingthismethodtomoveforwardcausesanerror.

IfeithertheBOForEOFpropertyisTrueandyouattempttousetheMovemethodwithoutavalidbookmark,arun-timeerroroccurs.

Notes

WhenyouuseMoveonaforward-only-typeRecordsetobject,therowsargumentmustbeapositiveintegerandbookmarksaren'tallowed.Thismeansyoucanonlymoveforward.

Tomakethefirst,last,next,orpreviousrecordinaRecordsetthecurrentrecord,useeithertheMoveFirst,MoveLast,MoveNext,orMovePreviousmethod.

UsingMovewithrowsequalto0isaneasywaytoretrievetheunderlyingdataforthecurrentrecord.Thisisusefulifyouwanttomakesurethatthecurrentrecordhasthemostrecentdatafromthebasetables.ItwillalsocancelanypendingEditorAddNewcalls.

Page 265: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MoveFirst,MoveLast,MoveNext,MovePreviousMethods

Movetothefirst,last,next,orpreviousrecordinaspecifiedRecordsetobjectandmakethatrecordthecurrentrecord.

Syntax

recordset.{MoveFirst|MoveLast[dbRunAsync]|MoveNext|MovePrevious}

TherecordsetplaceholderisanobjectvariablethatrepresentsanopenRecordsetobject.

Remarks

UsetheMovemethodstomovefromrecordtorecordwithoutapplyingacondition.

CautionIfyoueditthecurrentrecord,besureyouusetheUpdatemethodtosavethechangesbeforeyoumovetoanotherrecord.Ifyoumovetoanotherrecordwithoutupdating,yourchangesarelostwithoutwarning.

Page 266: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

WhenyouopenaRecordset,thefirstrecordiscurrentandtheBOFpropertyisFalse.IftheRecordsetcontainsnorecords,theBOFpropertyisTrue,andthereisnocurrentrecord.

IfthefirstorlastrecordisalreadycurrentwhenyouuseMoveFirstorMoveLast,thecurrentrecorddoesn'tchange.

IfyouuseMovePreviouswhenthefirstrecordiscurrent,theBOFpropertyisTrue,andthereisnocurrentrecord.IfyouuseMovePreviousagain,anerroroccurs,andBOFremainsTrue.

IfyouuseMoveNextwhenthelastrecordiscurrent,theEOFpropertyisTrue,andthereisnocurrentrecord.IfyouuseMoveNextagain,anerroroccurs,andEOFremainsTrue.

Ifrecordsetreferstoatable-typeRecordset(MicrosoftJetworkspacesonly),movementfollowsthecurrentindex.YoucansetthecurrentindexbyusingtheIndexproperty.Ifyoudon'tsetthecurrentindex,theorderofreturnedrecordsisundefined.

ImportantYoucanusetheMoveLastmethodtofullypopulateadynaset-orsnapshot-typeRecordsettoprovidethecurrentnumberofrecordsintheRecordset.However,ifyouuseMoveLastinthisway,youcanslowdownyourapplication'sperformance.YoushouldonlyuseMoveLasttogetarecordcountifitisabsolutelynecessarytoobtainanaccuraterecordcountonanewlyopenedRecordset.IfyouusethedbRunAsyncconstantwithMoveLast,themethodcallisasynchronous.YoucanusetheStillExecutingpropertytodeterminewhentheRecordsetisfullypopulated,andyoucanusetheCancelmethodtoterminateexecutionoftheasynchronousMoveLastmethodcall.

Youcan'tusetheMoveFirst,MoveLast,andMovePreviousmethodsonaforward-only–typeRecordsetobject.

TomovethepositionofthecurrentrecordinaRecordsetobjectaspecificnumberofrecordsforwardorbackward,usetheMovemethod.

Page 267: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NewPasswordMethod

ChangesthepasswordofanexistinguseraccountorMicrosoftJetdatabase(MicrosoftJetworkspacesonly).

NoteUsestrongpasswordsthatcombineupper-andlowercaseletters,numbers,andsymbols.Weakpasswordsdon'tmixtheseelements.Strongpassword:Y6dh!et5.Weakpassword:House27.Useastrongpasswordthatyoucanremembersothatyoudon'thavetowriteitdown.

Syntax

object.NewPasswordoldpassword,newpassword

TheNewPasswordmethodsyntaxhastheseparts.

Part Description

objectAnobjectvariablethatrepresentstheUserobjectoraMicrosoftJet3.xDatabaseobjectwhosePasswordpropertyyouwanttochange.

oldpassword AStringthatisthecurrentsettingofthePasswordpropertyoftheUserorJet3.xDatabaseobject.AStringthatisthenewsettingofthePasswordpropertyoftheUserorJet3.xDatabaseobject.

Page 268: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

newpasswordNoteUsestrongpasswordsthatcombineupper-andlowercaseletters,numbers,andsymbols.Weakpasswordsdon'tmixtheseelements.Strongpassword:Y6dh!et5.Weakpassword:House27.Useastrongpasswordthatyoucanremembersothatyoudon'thavetowriteitdown.

Remarks

Theoldpasswordandnewpasswordstringscanbeupto14characterslongandcanincludeanycharactersexcepttheASCIIcharacter0(null).Toclearthepassword,useazero-lengthstring("")fornewpassword.

Passwordsarecase-sensitive.

IfobjectreferstoaUserobjectthatisnotyetappendedtoaUserscollection,anerroroccurs.Tosetanewpassword,youmusteitherlogonastheuserwhoseaccountyou'rechanging,oryoumustbeamemberoftheAdminsgroup.ThePasswordpropertyofaUserobjectiswrite-only—userscan'treadthecurrentvalue.

IfobjectreferstoaMicrosoftJetversion3.0orlaterDatabaseobject,thismethodofferssomesecuritybymeansofpasswordprotection.WhenyoucreateoropenaMicrosoftJet3.x.mdbfile,partoftheConnectconnectionstringcandescribethepassword.

Ifadatabasehasnopassword,MicrosoftJetwillautomaticallycreateonebypassingazero-lengthstring("")fortheoldpassword.

CautionIfyouloseyourpassword,youcanneveropenthedatabaseagain.

Page 269: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NextRecordsetMethod

Getsthenextsetofrecords,ifany,returnedbyamulti-partselectqueryinanOpenRecordsetcall,andreturnsaBooleanvalueindicatingwhetheroneormoreadditionalrecordsarepending(ODBCDirectworkspacesonly).

Syntax

boolean=recordset.NextRecordset

TheNextRecordsetmethodsyntaxhastheseparts:

Part Description

boolean

ABooleanvariable.Trueindicatesthenextsetofrecordsisavailableinrecordset;Falseindicatesthatnomorerecordsarependingandrecordsetisnowempty.

recordset AnexistingRecordsetvariabletowhichyouwanttoreturnpendingrecords.

Remarks

InanODBCDirectworkspace,youcanopenaRecordsetcontaining

Page 270: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

morethanoneselectqueryinthesourceargumentofOpenRecordset,ortheSQLpropertyofaselectqueryQueryDefobject,asinthefollowingexample.

SELECTLastName,FirstNameFROMAuthorsWHERELastName='Smith';SELECTTitle,ISBNFROMTitlesWHEREPub_ID=9999

ThereturnedRecordsetwillopenwiththeresultsofthefirstquery.Toobtaintheresultsetsofrecordsfromsubsequentqueries,usetheNextRecordsetmethod.

Ifmorerecordsareavailable(thatis,therewasanotherselectqueryintheOpenRecordsetcallorintheSQLproperty),therecordsreturnedfromthenextquerywillbeloadedintotheRecordset,andNextRecordsetwillreturnTrue,indicatingthattherecordsareavailable.Whennomorerecordsareavailable(thatis,resultsofthelastselectqueryhavebeenloadedintotheRecordset),thenNextRecordsetwillreturnFalse,andtheRecordsetwillbeempty.

YoucanalsousetheCancelmethodtoflushthecontentsofaRecordset.However,Cancelalsoflushesanyadditionalrecordsnotyetloaded.

Page 271: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

OpenConnectionMethod

OpensaConnectionobjectonanODBCdatasource(ODBCDirectworkspacesonly).

Syntax

Setconnection=workspace.OpenConnection(name,options,readonly,connect)

TheOpenConnectionmethodsyntaxhastheseparts.

Part Description

connection AConnectionobjectvariabletowhichthenewconnectionwillbeassigned.

workspace

Optional.AvariableofaWorkspaceobjectdatatypethatreferencestheexistingWorkspaceobjectthatwillcontainthenewconnection.

name Astringexpression.SeethediscussionunderRemarks.

options

Optional.AVariantthatsetsvariousoptionsfortheconnection,asspecifiedinSettings.Basedonthisvalue,theODBCdriver

Page 272: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

managerpromptstheuserforconnectioninformationsuchasdatasourcename(DSN),username,andpassword.

readonly

Optional.ABooleanvaluethatisTrueiftheconnectionistobeopenedforread-onlyaccessandFalseiftheconnectionistobeopenedforread/writeaccess(default).

connect

Optional.AnODBCconnectstring.SeetheConnectpropertyforthespecificelementsandsyntaxofthisstring.Aprepended"ODBC;"isrequired.Ifconnectisomitted,theUIDand/orPWDwillbetakenfromtheUserNameandPasswordpropertiesoftheWorkspace.

Settings

Theoptionsargumentdeterminesifandwhentoprompttheusertoestablishtheconnection,andwhetherornottoopentheconnectionasynchronously.Youcanuseoneofthefollowingconstants.

Constant Description

dbDriverNoPrompt

TheODBCDriverManagerusestheconnectionstringprovidedindbnameandconnect.Ifyoudon'tprovidesufficientinformation,arun-timeerroroccurs.

dbDriverPrompt

TheODBCDriverManagerdisplaystheODBCDataSourcesdialogbox,whichdisplaysanyrelevantinformationsuppliedindbnameorconnect.TheconnectionstringismadeupoftheDSNthattheuserselectsviathedialogboxes,or,iftheuserdoesn'tspecifyaDSN,thedefaultDSNisused.

dbDriverComplete

Default.Iftheconnectargumentincludesallthenecessaryinformationtocompleteaconnection,theODBCDriverManagerusesthestringinconnect.OtherwiseitbehavesasitdoeswhenyouspecifydbDriverPrompt.

dbDriverCompleteRequired

ThisoptionbehaveslikedbDriverCompleteexcepttheODBCdriverdisablesthepromptsforanyinformationnotrequiredtocompletethe

Page 273: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

connection.

dbRunAsyncExecutethemethodasynchronously.Thisconstantmaybeusedwithanyoftheotheroptionsconstants.

Remarks

UsetheOpenConnectionmethodtoestablishaconnectiontoanODBCdatasourcefromanODBCDirectworkspace.TheOpenConnectionmethodissimilarbutnotequivalenttoOpenDatabase.ThemaindifferenceisthatOpenConnectionisavailableonlyinanODBCDirectworkspace.

IfyouspecifyaregisteredODBCdatasourcename(DSN)intheconnectargument,thenthenameargumentcanbeanyvalidstring,andwillalsoprovidetheNamepropertyfortheConnectionobject.IfavalidDSNisnotincludedintheconnectargument,thennamemustrefertoavalidODBCDSN,whichwillalsobetheNameproperty.IfneithernamenorconnectcontainsavalidDSN,theODBCdrivermanagercanbeset(viatheoptionsargument)toprompttheuserfortherequiredconnectioninformation.TheDSNsuppliedthroughthepromptthenprovidestheNameproperty.

OpenConnectionreturnsaConnectionobjectwhichcontainsinformationabouttheconnection.TheConnectionobjectissimilartoaDatabaseobject.TheprincipaldifferenceisthataDatabaseobjectusuallyrepresentsadatabase,althoughitcanbeusedtorepresentaconnectiontoanODBCdatasourcefromaMicrosoftJetworkspace.

Page 274: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

OpenDatabaseMethod

OpensaspecifieddatabaseinaWorkspaceobjectandreturnsareferencetotheDatabaseobjectthatrepresentsit.

Syntax

Setdatabase=workspace.OpenDatabase(dbname,options,read-only,connect)

TheOpenDatabasemethodsyntaxhastheseparts.

Part Description

database AnobjectvariablethatrepresentstheDatabaseobjectthatyouwanttoopen.

workspace

Optional.AnobjectvariablethatrepresentstheexistingWorkspaceobjectthatwillcontainthedatabase.Ifyoudon'tincludeavalueforworkspace,OpenDatabaseusesthedefaultworkspace.

dbnameAStringthatisthenameofanexistingMicrosoftJetdatabasefile,orthedatasourcename(DSN)ofanODBCdatasource.SeetheNamepropertyformoreinformationaboutsettingthisvalue.

options Optional.AVariantthatsetsvariousoptionsforthedatabase,asspecifiedinSettings.

Page 275: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

read-onlyOptional.AVariant(Booleansubtype)valuethatisTrueifyouwanttoopenthedatabasewithread-onlyaccess,orFalse(default)ifyouwanttoopenthedatabasewithread/writeaccess.

connect Optional.AVariant(Stringsubtype)thatspecifiesvariousconnectioninformation,includingpasswords.

Settings

ForMicrosoftJetworkspaces,youcanusethefollowingvaluesfortheoptionsargument.

Setting DescriptionTrue Opensthedatabaseinexclusivemode.

False (Default)Opensthedatabaseinsharedmode.

ForODBCDirectworkspaces,theoptionsargumentdeterminesifandwhentoprompttheusertoestablishtheconnection.Youcanuseoneofthefollowingconstants.

Constant Description

dbDriverNoPrompt

TheODBCDriverManagerusestheconnectionstringprovidedindbnameandconnect.Ifyoudon'tprovidesufficientinformation,arun-timeerroroccurs.

dbDriverPrompt

TheODBCDriverManagerdisplaystheODBCDataSourcesdialogbox,whichdisplaysanyrelevantinformationsuppliedindbnameorconnect.TheconnectionstringismadeupoftheDSNthattheuserselectsviathedialogboxes,or,iftheuserdoesn'tspecifyaDSN,thedefaultDSNisused.

dbDriverComplete

(Default)Iftheconnectanddbnameargumentsincludeallthenecessaryinformationtocompleteaconnection,theODBCDriverManagerusesthestringinconnect.OtherwiseitbehavesasitdoeswhenyouspecifydbDriverPrompt.ThisoptionbehaveslikedbDriverComplete

Page 276: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbDriverCompleteRequired excepttheODBCdriverdisablesthepromptsforanyinformationnotrequiredtocompletetheconnection.

Remarks

Whenyouopenadatabase,itisautomaticallyaddedtotheDatabasescollection.Further,inanODBCDirectworkspace,theConnectionobjectcorrespondingtothenewDatabaseobjectisalsocreatedandappendedtotheConnectionscollectionofthesameWorkspaceobject.

Someconsiderationsapplywhenyouusedbname:

Ifitreferstoadatabasethatisalreadyopenforexclusiveaccessbyanotheruser,anerroroccurs.

Ifitdoesn'trefertoanexistingdatabaseorvalidODBCdatasourcename,anerroroccurs.

Ifit'sazero-lengthstring("")andconnectis"ODBC;",adialogboxlistingallregisteredODBCdatasourcenamesisdisplayedsotheusercanselectadatabase.

Ifyou'reopeningadatabasethroughanODBCDirectworkspaceandyouprovidetheDSNinconnect,youcansetdbnametoastringofyourchoicethatyoucanusetoreferencethisdatabaseinsubsequentcode.

Theconnectargumentisexpressedintwoparts:thedatabasetype,followedbyasemicolon(;)andtheoptionalarguments.Youmustfirstprovidethedatabasetype,suchas"ODBC;"or"FoxPro2.5;".Theoptionalargumentsfollowinnoparticularorder,separatedbysemicolons.Oneoftheparametersmaybethepassword(ifoneis

Page 277: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

assigned).Forexample:

"FoxPro2.5;pwd=mypassword"

UsingtheNewPasswordmethodonaDatabaseobjectotherthananODBCDirectdatabasechangesthepasswordparameterthatappearsinthe";pwd=..."partofthisargument.Youmustsupplytheoptionsandread-onlyargumentstosupplyasourcestring.SeetheConnectpropertyforsyntax.

Tocloseadatabase,andthusremovetheDatabaseobjectfromtheDatabasescollection,usetheClosemethodontheobject.

NoteWhenyouaccessaMicrosoftJet-connectedODBCdatasource,youcanimproveyourapplication'sperformancebyopeningaDatabaseobjectconnectedtotheODBCdatasource,ratherthanbylinkingindividualTableDefobjectstospecifictablesintheODBCdatasource.

Page 278: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

OpenRecordsetMethod

CreatesanewRecordsetobjectandappendsittotheRecordsetscollection.

Syntax

ForConnectionandDatabaseobjects:

Setrecordset=object.OpenRecordset(source,type,options,lockedits)

ForQueryDef,Recordset,andTableDefobjects:

Setrecordset=object.OpenRecordset(type,options,lockedits)

TheOpenRecordsetmethodsyntaxhastheseparts.

Part Description

recordset AnobjectvariablethatrepresentstheRecordsetobjectyouwanttoopen.

object AnobjectvariablethatrepresentsanexistingobjectfromwhichyouwanttocreatethenewRecordset.AStringspecifyingthesourceoftherecordsforthenewRecordset.Thesourcecanbeatablename,aqueryname,oran

Page 279: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

source SQLstatementthatreturnsrecords.Fortable-typeRecordsetobjectsinMicrosoftJetdatabases,thesourcecanonlybeatablename.

type Optional.AconstantthatindicatesthetypeofRecordsettoopen,asspecifiedinSettings.

options Optional.AcombinationofconstantsthatspecifycharacteristicsofthenewRecordset,aslistedinSettings.

lockedits Optional.AconstantthatdeterminesthelockingfortheRecordset,asspecifiedinSettings.

Settings

Youcanuseoneofthefollowingconstantsforthetypeargument.

Constant Description

dbOpenTable Opensatable-typeRecordsetobject(MicrosoftJetworkspacesonly).

dbOpenDynamicOpensadynamic-typeRecordsetobject,whichissimilartoanODBCdynamiccursor.(ODBCDirectworkspacesonly)

dbOpenDynaset Opensadynaset-typeRecordsetobject,whichissimilartoanODBCkeysetcursor.

dbOpenSnapshot Opensasnapshot-typeRecordsetobject,whichissimilartoanODBCstaticcursor.

dbOpenForwardOnly Opensaforward-only-typeRecordsetobject.

NoteIfyouopenaRecordsetinaMicrosoftJetworkspaceandyoudon'tspecifyatype,OpenRecordsetcreatesatable-typeRecordset,ifpossible.Ifyouspecifyalinkedtableorquery,OpenRecordsetcreatesadynaset-typeRecordset.InanODBCDirectworkspace,thedefaultsettingisdbOpenForwardOnly.

Youcanuseacombinationofthefollowingconstantsfortheoptionsargument.

Constant Description

dbAppendOnly

AllowsuserstoappendnewrecordstotheRecordset,butpreventsthemfromeditingordeletingexistingrecords(MicrosoftJetdynaset-type

Page 280: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Recordsetonly).

dbSQLPassThroughPassesanSQLstatementtoaMicrosoftJet-connectedODBCdatasourceforprocessing(MicrosoftJetsnapshot-typeRecordsetonly).

dbSeeChanges

Generatesarun-timeerrorifoneuserischangingdatathatanotheruserisediting(MicrosoftJetdynaset-typeRecordsetonly).Thisisusefulinapplicationswheremultipleusershavesimultaneousread/writeaccesstothesamedata.

dbDenyWrite Preventsotherusersfrommodifyingoraddingrecords(MicrosoftJetRecordsetobjectsonly).

dbDenyRead Preventsotherusersfromreadingdatainatable(MicrosoftJettable-typeRecordsetonly).

dbForwardOnly

Createsaforward-onlyRecordset(MicrosoftJetsnapshot-typeRecordsetonly).Itisprovidedonlyforbackwardcompatibility,andyoushouldusethedbOpenForwardOnlyconstantinthetypeargumentinsteadofusingthisoption.

dbReadOnly

PreventsusersfrommakingchangestotheRecordset(MicrosoftJetonly).ThedbReadOnlyconstantinthelockeditsargumentreplacesthisoption,whichisprovidedonlyforbackwardcompatibility.

dbRunAsync Runsanasynchronousquery(ODBCDirectworkspacesonly).

dbExecDirect

RunsaquerybyskippingSQLPrepareanddirectlycallingSQLExecDirect(ODBCDirectworkspacesonly).Usethisoptiononlywhenyou’renotopeningaRecordsetbasedonaparameterquery.Formoreinformation,seethe"MicrosoftODBC3.0Programmer’sReference."

dbInconsistent Allowsinconsistentupdates(MicrosoftJetdynaset-typeandsnapshot-typeRecordsetobjectsonly).

dbConsistentAllowsonlyconsistentupdates(MicrosoftJetdynaset-typeandsnapshot-typeRecordsetobjectsonly).

NoteTheconstantsdbConsistentanddbInconsistentaremutuallyexclusive,andusingbothcausesanerror.Supplyingalockedits

Page 281: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

argumentwhenoptionsusesthedbReadOnlyconstantalsocausesanerror.

Youcanusethefollowingconstantsforthelockeditsargument.

Constant Description

dbReadOnly

PreventsusersfrommakingchangestotheRecordset(defaultforODBCDirectworkspaces).YoucanusedbReadOnlyineithertheoptionsargumentorthelockeditsargument,butnotboth.Ifyouuseitforbotharguments,arun-timeerroroccurs.

dbPessimistic

UsespessimisticlockingtodeterminehowchangesaremadetotheRecordsetinamultiuserenvironment.Thepagecontainingtherecordyou'reeditingislockedassoonasyouusetheEditmethod(defaultforMicrosoftJetworkspaces).

dbOptimistic

UsesoptimisticlockingtodeterminehowchangesaremadetotheRecordsetinamultiuserenvironment.ThepagecontainingtherecordisnotlockeduntiltheUpdatemethodisexecuted.

dbOptimisticValue Usesoptimisticconcurrencybasedonrowvalues(ODBCDirectworkspacesonly).

dbOptimisticBatch Enablesbatchoptimisticupdating(ODBCDirectworkspacesonly).

Remarks

InaMicrosoftJetworkspace,ifobjectreferstoaQueryDefobject,oradynaset-orsnapshot-typeRecordset,orifsourcereferstoanSQLstatementoraTableDefthatrepresentsalinkedtable,youcan'tusedbOpenTableforthetypeargument;ifyoudo,arun-timeerroroccurs.IfyouwanttouseanSQLpass-throughqueryonalinkedtableinaMicrosoftJet-connectedODBCdatasource,youmustfirstsettheConnectpropertyofthelinkedtable'sdatabasetoavalidODBCconnectionstring.IfyouonlyneedtomakeasinglepassthroughaRecordsetopenedfromaMicrosoftJet-connectedODBCdatasource,youcanimproveperformancebyusingdbOpenForwardOnlyforthe

Page 282: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

typeargument.

Ifobjectreferstoadynaset-orsnapshot-typeRecordset,thenewRecordsetisofthesametypeobject.Ifobjectreferstoatable-typeRecordsetobject,thetypeofthenewobjectisadynaset-typeRecordset.Youcan'topennewRecordsetobjectsfromforward-only–typeorODBCDirectRecordsetobjects.

InanODBCDirectworkspace,youcanopenaRecordsetcontainingmorethanoneselectqueryinthesourceargument,suchas

"SELECTLastName,FirstNameFROMAuthorsWHERELastName='Smith';SELECTTitle,ISBNFROMTitlesWHEREISBNLike'1-55615-*'"

ThereturnedRecordsetwillopenwiththeresultsofthefirstquery.Toobtaintheresultsetsofrecordsfromsubsequentqueries,usetheNextRecordsetmethod.

NoteYoucansendDAOqueriestoavarietyofdifferentdatabaseserverswithODBCDirect,anddifferentserverswillrecognizeslightlydifferentdialectsofSQL.Therefore,context-sensitiveHelpisnolongerprovidedforMicrosoftJetSQL,althoughonlineHelpforMicrosoftJetSQLisstillincludedthroughtheHelpmenu.BesuretochecktheappropriatereferencedocumentationfortheSQLdialectofyourdatabaseserverwhenusingeitherODBCDirectconnectionsorpass-throughqueriesinMicrosoftJet-connectedclient/serverapplications.

UsethedbSeeChangesconstantinaMicrosoftJetworkspaceifyouwanttotrapchangeswhiletwoormoreusersareeditingordeletingthesamerecord.Forexample,iftwousersstarteditingthesamerecord,thefirstusertoexecutetheUpdatemethodsucceeds.WhentheseconduserinvokestheUpdatemethod,arun-timeerroroccurs.Similarly,ifthesecondusertriestousetheDeletemethodtodeletetherecord,andthefirstuserhasalreadychangedit,arun-timeerroroccurs.

Page 283: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Typically,iftheusergetsthiserrorwhileupdatingarecord,yourcodeshouldrefreshthecontentsofthefieldsandretrievethenewlymodifiedvalues.Iftheerroroccurswhiledeletingarecord,yourcodecoulddisplaythenewrecorddatatotheuserandamessageindicatingthatthedatahasrecentlychanged.Atthispoint,yourcodecanrequestaconfirmationthattheuserstillwantstodeletetherecord.

YoushouldalsousethedbSeeChangesconstantifyouopenaRecordsetinaMicrosoftJet-connectedODBCworkspaceagainstaMicrosoftSQLServer6.0(orlater)tablethathasanIDENTITYcolumn,otherwiseanerrormayresult.

InanODBCDirectworkspace,youcanexecuteasynchronousqueriesbysettingthedbRunAsyncconstantintheoptionsargument.Thisallowsyourapplicationtocontinueprocessingotherstatementswhilethequeryrunsinthebackground.But,youcannotaccesstheRecordsetdatauntilthequeryhascompleted.Todeterminewhetherthequeryhasfinishedexecuting,checktheStillExecutingpropertyofthenewRecordset.Ifthequerytakeslongertocompletethanyouanticipated,youcanterminateexecutionofthequerywiththeCancelmethod.

OpeningmorethanoneRecordsetonanODBCdatasourcemayfailbecausetheconnectionisbusywithapriorOpenRecordsetcall.Onewayaroundthisistouseaserver-sidecursorandODBCDirect,iftheserversupportsthis.AnothersolutionistofullypopulatetheRecordsetbyusingtheMoveLastmethodassoonastheRecordsetisopened.

IfyouopenaConnectionobjectwithDefaultCursorDriversettodbUseClientBatchCursor,youcanopenaRecordsettocachechangestothedata(knownasbatchupdating)inanODBCDirectworkspace.IncludedbOptimisticBatchinthelockeditsargumenttoenableupdatecaching.SeetheUpdatemethodtopicfordetailsabouthowtowritechangestodiskimmediately,ortocachechangesandwritethemtodiskasabatch.

ClosingaRecordsetwiththeClosemethodautomaticallydeletesitfromtheRecordsetscollection.

Page 284: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteIfsourcereferstoanSQLstatementcomposedofastringconcatenatedwithanon-integervalue,andthesystemparametersspecifyanon-U.S.decimalcharactersuchasacomma(forexample,strSQL="PRICE>"&lngPrice,andlngPrice=125,50),anerroroccurswhenyoutrytoopentheRecordset.Thisisbecauseduringconcatenation,thenumberwillbeconvertedtoastringusingyoursystem'sdefaultdecimalcharacter,andSQLonlyacceptsU.S.decimalcharacters.

Page 285: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PopulatePartialMethod

Synchronizesanychangesinapartialreplicawiththefullreplica,clearsallrecordsinthepartialreplica,andthenrepopulatesthepartialreplicabasedonthecurrentreplicafilters.(MicrosoftJetdatabasesonly.)

Syntax

database.PopulatePartialdbname

ThePopulatePartialmethodsyntaxhasthefollowingparts.

Part Description

databaseAnobjectvariablethatreferencesthepartialreplicaDatabaseobjectthatyouwanttopopulate.

dbname Astringspecifyingthepathandnameofthefullreplicafromwhichtopopulaterecords.

Remarks

Whenyousynchronizeapartialreplicawithafullreplica,itispossibletocreate"orphaned"recordsinthepartialreplica.Forexample,supposeyouhaveaCustomerstablewithitsReplicaFiltersetto"Region=

Page 286: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

'CA'".Ifauserchangesacustomer'sregionfromCAtoNYinthepartialreplica,andthenasynchronizationoccursviatheSynchronizemethod,thechangeispropagatedtothefullreplicabuttherecordcontainingNYinthepartialreplicaisorphanedbecauseitnowdoesn'tmeetthereplicafiltercriteria.

Tosolvetheproblemoforphanedrecords,youcanusethePopulatePartialmethod.ThePopulatePartialmethodissimilartotheSynchronizemethod,butitsynchronizesanychangeswiththefullreplica,removesallrecordsinthepartialreplica,andthenrepopulatesthepartialreplicabasedonthecurrentreplicafilters.Evenifyourreplicafiltershavenotchanged,PopulatePartialwillalwaysclearallrecordsinthepartialreplicaandrepopulateitbasedonthecurrentfilters.

Generally,youshouldusethePopulatePartialmethodwhenyoucreateapartialreplicaandwheneveryouchangeyourreplicafilters.Ifyourapplicationchangesreplicafilters,youshouldfollowthesesteps:

1. Synchronizeyourfullreplicawiththepartialreplicainwhichthefiltersarebeingchanged.

2. UsetheReplicaFilterandPartialReplicapropertiestomakethedesiredchangestothereplicafilter.

3. CallthePopulatePartialmethodtoremoveallrecordsfromthepartialreplicaandtransferallrecordsfromthefullreplicathatmeetthenewreplicafiltercriteria.

Ifareplicafilterhaschanged,andtheSynchronizemethodisinvokedwithoutfirstinvokingPopulatePartial,atrappableerroroccurs.

ThePopulatePartialmethodcanonlybeinvokedonapartialreplicathathasbeenopenedforexclusiveaccess.Furthermore,youcan'tcallthePopulatePartialmethodfromcoderunningwithinthepartialreplicaitself.Instead,openthepartialreplicaexclusivelyfromthefullreplicaor

Page 287: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

anotherdatabase,thencallPopulatePartial.

NoteAlthoughPopulatePartialperformsaone-waysynchronizationbeforeclearingandrepopulatingthepartialreplica,itisstillagoodideatocallSynchronizebeforecallingPopulatePartial.ThisisbecauseifthecalltoSynchronizefails,atrappableerroroccurs.YoucanusethiserrortodecidewhetherornottoproceedwiththePopulatePartialmethod(whichremovesallrecordsinthepartialreplica).IfPopulatePartialiscalledbyitselfandanerroroccurswhilerecordsarebeingsynchronized,recordsinthepartialreplicawillstillbecleared,whichmaynotbethedesiredresult.

Page 288: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RefreshMethod

Updatestheobjectsinacollectiontoreflectthecurrentdatabase'sschema.

Syntax

collection.Refresh

Thecollectionplaceholderisanobjectvariablethatrepresentsapersistentcollection.

Remarks

Youcan'tusetheRefreshmethodwithcollectionsthataren'tpersistent,suchasConnections,Databases,Recordsets,Workspaces,ortheQueryDefscollectionofaConnectionobject.

TodeterminethepositionthattheMicrosoftJetdatabaseengineusesforFieldobjectsintheFieldscollectionofaQueryDef,Recordset,orTableDefobject,usetheOrdinalPositionpropertyofeachFieldobject.ChangingtheOrdinalPositionpropertyofaFieldobjectmaynotchangetheorderoftheFieldobjectsinthecollectionuntilyouusetheRefresh

Page 289: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

method.

UsetheRefreshmethodinmultiuserenvironmentsinwhichotherusersmaychangethedatabase.Youmayalsoneedtouseitonanycollectionsthatareindirectlyaffectedbychangestothedatabase.Forexample,ifyouchangeaUserscollection,youmayneedtorefreshaGroupscollectionbeforeusingtheGroupscollection.

Acollectionisfilledwithobjectsthefirsttimeit'sreferredtoandwon'tautomaticallyreflectsubsequentchangesotherusersmake.Ifit'slikelythatanotheruserhaschangedacollection,usetheRefreshmethodonthecollectionimmediatelybeforecarryingoutanytaskinyourapplicationthatassumesthepresenceorabsenceofaparticularobjectinthecollection.Thiswillensurethatthecollectionisasup-to-dateaspossible.Ontheotherhand,usingRefreshcanunnecessarilyslowperformance.

Page 290: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RefreshLinkMethod

Updatestheconnectioninformationforalinkedtable(MicrosoftJetworkspacesonly).

Syntax

tabledef.RefreshLink

ThetabledefplaceholderspecifiestheTableDefobjectrepresentingthelinkedtablewhoseconnectioninformationyouwanttoupdate.

Remarks

Tochangetheconnectioninformationforalinkedtable,resettheConnectpropertyofthecorrespondingTableDefobjectandthenusetheRefreshLinkmethodtoupdatetheinformation.UsingRefreshLinkmethoddoesn'tchangethelinkedtable'spropertiesandRelationobjects.

ForthisconnectioninformationtoexistinallcollectionsassociatedwiththeTableDefobjectthatrepresentsthelinkedtable,youmustusetheRefreshmethodoneachcollection.

Page 291: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RegisterDatabaseMethod

EntersconnectioninformationforanODBCdatasourceintheWindowsRegistry.TheODBCdriverneedsconnectioninformationwhentheODBCdatasourceisopenedduringasession.

Syntax

DBEngine.RegisterDatabasedbname,driver,silent,attributes

TheRegisterDatabasemethodsyntaxhastheseparts.

Part Description

dbname

AStringthatisthenameusedintheOpenDatabasemethod.Itreferstoablockofdescriptiveinformationaboutthedatasource.Forexample,ifthedatasourceisanODBCremotedatabase,itcouldbethenameoftheserver.

driver

AStringthatisthenameoftheODBCdriver.Thisisn'tthenameoftheODBCdriverDLLfile.Forexample,SQLServerisadrivername,butSQLSRVR.dllisthenameofaDLLfile.YoumusthaveODBCandtheappropriatedriveralreadyinstalled.

silent

ABooleanthatisTrueifyoudon'twanttodisplaytheODBCdriverdialogboxesthatpromptfordriver-specificinformation;orFalseifyouwanttodisplaytheODBCdriverdialogboxes.If

Page 292: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

silentisTrue,attributesmustcontainallthenecessarydriver-specificinformationorthedialogboxesaredisplayedanyway.

attributes AStringthatisalistofkeywordstobeaddedtotheWindowsRegistry.Thekeywordsareinacarriage-return–delimitedstring.

Remarks

Ifthedatabaseisalreadyregistered(connectioninformationisalreadyentered)intheWindowsRegistrywhenyouusetheRegisterDatabasemethod,theconnectioninformationisupdated.

IftheRegisterDatabasemethodfailsforanyreason,nochangesaremadetotheWindowsRegistry,andanerroroccurs.

FormoreinformationaboutODBCdriverssuchasSQLServer,seetheHelpfileprovidedwiththedriver.

YoushouldusetheODBCDataSourcesdialogboxintheControlPaneltoaddnewdatasources,ortomakechangestoexistingentries.However,ifyouusetheRegisterDatabasemethod,youshouldsetthesilentoptiontoTrue.

Page 293: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RepairDatabaseMethod

NoteTheRepairDatabasefunctionisnolongeravailable.UsetheCompactDatabasemethodinstead.

AttemptstorepairacorruptedMicrosoftJetdatabase(MicrosoftJetdatabasesonly).

Syntax

DBEngine.RepairDatabasedbname

ThedbnameargumentisaStringthatisthepathandfilenameforanexistingMicrosoftJetdatabasefile.Ifyouomitthepath,onlythecurrentdirectoryissearched.Ifyoursystemsupportstheuniformnamingconvention(UNC),youcanalsospecifyanetworkpath,suchas"\\server1\share1\dir1\db1.mdb".

Remarks

Youmustclosethedatabasespecifiedbydbnamebeforeyourepairit.Inamultiuserenvironment,otheruserscan'thavedbnameopenwhileyou'rerepairingit.Ifdbnameisn'tclosedorisn'tavailableforexclusive

Page 294: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

use,anerroroccurs.

Thismethodattemptstorepairadatabasethatwasmarkedaspossiblycorruptbyanincompletewriteoperation.ThiscanoccurifanapplicationusingtheMicrosoftJetdatabaseengineisclosedunexpectedlybecauseofapoweroutageorcomputerhardwareproblem.Thedatabasewon'tbemarkedaspossiblycorruptifyouusetheClosemethodorifyouquityourapplicationinausualway.

TheRepairDatabasemethodalsoattemptstovalidateallsystemtablesandallindexes.Anydatathatcan'tberepairedisdiscarded.Ifthedatabasecan'tberepaired,arun-timeerroroccurs.

Whenyouattempttoopenorcompactacorrupteddatabase,arun-timeerrorusuallyoccurs.Insomesituations,however,acorrupteddatabasemaynotbedetected,andnoerroroccurs.It'sagoodideatoprovideyouruserswithawaytousetheRepairDatabasemethodinyourapplicationiftheirdatabasebehavesunpredictably.

SometypesofdatabasescanbecomecorruptedifauserendsanapplicationwithoutclosingDatabaseorRecordsetobjectsandtheMicrosoftJetdatabaseengine;MicrosoftWindowsdoesn'thaveachancetowritedatacachestodisk.Toavoidcorruptdatabases,establishproceduresforclosingapplicationsandshuttingdownsystemsthatensurethatallcachedpagesaresavedtothedatabase.Insomecases,powersuppliesthatcan'tbeinterruptedmaybenecessarytopreventaccidentaldatalossduringpowerfluctuations.

NoteAfterrepairingadatabase,it'salsoagoodideatocompactitusingtheCompactDatabasemethodtodefragmentthefileandtorecoverdiskspace.

Page 295: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RequeryMethod

UpdatesthedatainaRecordsetobjectbyre-executingthequeryonwhichtheobjectisbased.

Syntax

recordset.Requerynewquerydef

TheRequerymethodsyntaxhasthefollowingparts.

Part Description

recordsetAnobjectvariablethatrepresentsanexistingMicrosoftJetdynaset-,snapshot-,orforward-only–typeRecordsetobject,oranODBCDirectRecordsetobject.

newquerydef Optional.AVariantthatrepresentstheNamepropertyvalueofaQueryDefobject(MicrosoftJetworkspacesonly).

Remarks

UsethismethodtomakesurethataRecordsetcontainsthemostrecentdata.Thismethodre-populatesthecurrentRecordsetbyusingeitherthecurrentqueryparametersor(inaMicrosoftJetworkspace)thenewonessuppliedbythenewquerydefargument.

Page 296: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

InanODBCDirectworkspace,iftheoriginalquerywasasynchronous,thenRequerywillalsoexecuteanasynchronousquery.

Ifyoudon'tspecifyanewquerydefargument,theRecordsetisre-populatedbasedonthesamequerydefinitionandparametersusedtooriginallypopulatetheRecordset.Anychangestotheunderlyingdatawillbereflectedduringthisre-population.Ifyoudidn'tuseaQueryDeftocreatetheRecordset,theRecordsetisre-createdfromscratch.

IfyouspecifytheoriginalQueryDefinthenewquerydefargument,thentheRecordsetisrequeriedusingtheparametersspecifiedbytheQueryDef.Anychangestotheunderlyingdatawillbereflectedduringthisre-population.ToreflectanychangestothequeryparametervaluesintheRecordset,youmustsupplythenewquerydefargument.

IfyouspecifyadifferentQueryDefthanwhatwasoriginallyusedtocreatetheRecordset,theRecordsetisre-createdfromscratch.

WhenyouuseRequery,thefirstrecordintheRecordsetbecomesthecurrentrecord.

Youcan'tusetheRequerymethodondynaset-orsnapshot-typeRecordsetobjectswhoseRestartablepropertyissettoFalse.However,ifyousupplytheoptionalnewquerydefargument,theRestartablepropertyisignored.

IfboththeBOFandEOFpropertysettingsoftheRecordsetobjectareTrueafteryouusetheRequerymethod,thequerydidn'treturnanyrecordsandtheRecordsetcontainsnodata.

Page 297: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SeekMethod

Locatestherecordinanindexedtable-typeRecordsetobjectthatsatisfiesthespecifiedcriteriaforthecurrentindexandmakesthatrecordthecurrentrecord(MicrosoftJetworkspacesonly).

Syntax

recordset.Seekcomparison,key1,key2...key13

TheSeekmethodsyntaxhasthefollowingparts.

Part Description

recordsetAnobjectvariablethatrepresentsanexistingtable-typeRecordsetobjectthathasadefinedindexasspecifiedbytheRecordsetobject'sIndexproperty.

comparison Oneofthefollowingstringexpressions:<,<=,=,>=,or>.

key1,key2...key13OneormorevaluescorrespondingtofieldsintheRecordsetobject'scurrentindex,asspecifiedbyitsIndexpropertysetting.Youcanuseupto13keyarguments.

Remarks

YoumustsetthecurrentindexwiththeIndexpropertybeforeyouuse

Page 298: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Seek.Iftheindexidentifiesanonuniquekeyfield,Seeklocatesthefirstrecordthatsatisfiesthecriteria.

TheSeekmethodsearchesthroughthespecifiedkeyfieldsandlocatesthefirstrecordthatsatisfiesthecriteriaspecifiedbycomparisonandkey1.Oncefound,itmakesthatrecordcurrentandsetstheNoMatchpropertytoFalse.IftheSeekmethodfailstolocateamatch,theNoMatchpropertyissettoTrue,andthecurrentrecordisundefined.

Ifcomparisonisequal(=),greaterthanorequal(>=),orgreaterthan(>),Seekstartsatthebeginningoftheindexandsearchesforward.

Ifcomparisonislessthan(<)orlessthanorequal(<=),Seekstartsattheendoftheindexandsearchesbackward.However,ifthereareduplicateindexentriesattheendoftheindex,Seekstartsatanarbitraryentryamongtheduplicatesandthensearchesbackward.

Youmustspecifyvaluesforallfieldsdefinedintheindex.IfyouuseSeekwithamultiple-columnindex,andyoudon'tspecifyacomparisonvalueforeveryfieldintheindex,thenyoucannotusetheequal(=)operatorinthecomparison.That'sbecausesomeofthecriteriafields(key2,key3,andsoon)willdefaulttoNull,whichwillprobablynotmatch.Therefore,theequaloperatorwillworkcorrectlyonlyifyouhavearecordwhichisallNullexceptthekeyyou'relookingfor.It'srecommendedthatyouusethegreaterthanorequal(>=)operatorinstead.

Thekey1argumentmustbeofthesamefielddatatypeasthecorrespondingfieldinthecurrentindex.Forexample,ifthecurrentindexreferstoanumberfield(suchasEmployeeID),key1mustbenumeric.Similarly,ifthecurrentindexreferstoaTextfield(suchasLastName),key1mustbeastring.

Theredoesn'thavetobeacurrentrecordwhenyouuseSeek.

YoucanusetheIndexescollectiontoenumeratetheexistingindexes.

Tolocatearecordinadynaset-orsnapshot-typeRecordsetthatsatisfiesaspecificconditionthatisnotcoveredbyexistingindexes,use

Page 299: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

theFindmethods.Toincludeallrecords,notjustthosethatsatisfyaspecificcondition,usetheMovemethodstomovefromrecordtorecord.

Youcan'tusetheSeekmethodonalinkedtablebecauseyoucan'topenlinkedtablesastable-typeRecordsetobjects.However,ifyouusetheOpenDatabasemethodtodirectlyopenaninstallableISAM(non-ODBC)database,youcanuseSeekontablesinthatdatabase.

InanODBCDirectworkspace,theFindandSeekmethodsarenotavailableonanytypeofRecordsetobject,becauseexecutingaFindorSeekthroughanODBCconnectionisnotveryefficientoverthenetwork.Instead,youshoulddesignthequery(thatis,usingthesourceargumenttotheOpenRecordsetmethod)withanappropriateWHEREclausethatrestrictsthereturnedrecordstoonlythosethatmeetthecriteriayouwouldotherwiseuseinaFindorSeek.

Page 300: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SetOptionMethod

TemporarilyoverridesvaluesfortheMicrosoftJetdatabaseenginekeysintheWindowsRegistry(MicrosoftJetworkspacesonly).

Syntax

DBEngine.SetOptionparameter,newvalue

TheSetOptionmethodsyntaxhastheseparts.

Part Descriptionparameter ALongconstantasdescribedinSettings.

newvalue AVariantvaluethatyouwanttosetparameterto.

Settings

EachconstantreferstothecorrespondingregistrykeyinthepathJet\3.5\Engines\Jet3.5\(thatis,dbSharedAsyncDelaycorrespondstothekeyJet\3.5\Engines\Jet3.5\SharedAsyncDelay,andsoon.).

Constant DescriptiondbPageTimeout ThePageTimeoutkey

Page 301: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbSharedAsyncDelay TheSharedAsyncDelaykeydbExclusiveAsyncDelay TheExclusiveAsyncDelaykeydbLockRetry TheLockRetrykeydbUserCommitSync TheUserCommitSynckeydbImplicitCommitSync TheImplicitCommitSynckeydbMaxBufferSize TheMaxBufferSizekeydbMaxLocksPerFile TheMaxLocksPerFilekeydbLockDelay TheLockDelaykeydbRecycleLVs TheRecycleLVskeydbFlushTransactionTimeoutTheFlushTransactionTimeoutkey

Remarks

UsetheSetOptionmethodtooverrideregistryvaluesatrun-time.NewvaluesestablishedwiththeSetOptionmethodremainineffectuntilchangedagainbyanotherSetOptioncall,oruntiltheDBEngineobjectisclosed.

Forfurtherdetailsonwhattheregistrykeysdo,andappropriatevaluestosetthemto,seeInitializingtheMicrosoftJet3.5DatabaseEngine.

Page 302: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SynchronizeMethod

Synchronizestworeplicas.(MicrosoftJetdatabasesonly).

Syntax

database.Synchronizepathname,exchange

TheSynchronizemethodsyntaxhasthefollowingparts.

Part Description

database AnobjectvariablethatrepresentsaDatabaseobjectthatisareplica.

pathnameAStringthatcontainsthepathtothetargetreplicawithwhichdatabasewillbesynchronized.The.mdbfilenameextensionisoptional.

exchange Optional.Aconstantindicatingwhichdirectiontosynchronizechangesbetweenthetwodatabases,asspecifiedinSettings.

Settings

Youcanusethefollowingconstantsintheexchangeargument.Youcanuseoneofthefirstthreeconstantswithorwithoutthefourthconstant.

Page 303: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Constant DescriptiondbRepExportChanges Sendschangesfromdatabasetopathname.dbRepImportChanges Sendschangesfrompathnametodatabase.

dbRepImpExpChanges (Default)Sendschangesfromdatabasetopathname,andvice-versa,alsoknownasbidirectionalexchange.

dbRepSyncInternet ExchangesdatabetweenfilesconnectedbyanInternetpathway.

Remarks

YouuseSynchronizetoexchangedataanddesignchangesbetweentwodatabases.Designchangesalwayshappenfirst.Bothdatabasesmustbeatthesamedesignlevelbeforetheycanexchangedata.Forexample,anexchangeoftypedbRepExportChangesmightcausedesignchangesatareplicaeventhoughdatachangesflowonlyfromthedatabasetopathname.

Thereplicaidentifiedinpathnamemustbepartofthesamereplicaset.IfbothreplicashavethesameReplicaIDpropertysettingorareDesignMastersfortwodifferentreplicasets,thesynchronizationfails.

WhenyousynchronizetworeplicasovertheInternet,youmustusethedbRepSyncInternetconstant.Inthiscase,youspecifyaUniformResourceLocator(URL)addressforthepathnameargumentinsteadofspecifyingalocalareanetworkpath.

NoteYoucan'tsynchronizepartialreplicaswithotherpartialreplicas.SeethePopulatePartialmethodformoreinformation.

SynchronizationovertheInternetrequirestheReplicationManager,whichisonlyavailableintheMicrosoftOffice97,DeveloperEdition.

Page 304: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UpdateMethod

SavesthecontentsofthecopybuffertoanupdatableRecordsetobject.

Syntax

recordset.Update(type,force)

TheUpdatemethodsyntaxhasthefollowingparts.

Part Description

recordset Anobjectvariablethatrepresentsanopen,updatableRecordsetobject.

type Optional.Aconstantindicatingthetypeofupdate,asspecifiedinSettings(ODBCDirectworkspacesonly).

force

Optional.ABooleanvalueindicatingwhetherornottoforcethechangesintothedatabase,regardlessofwhethertheunderlyingdatahasbeenchangedbyanotherusersincetheAddNew,Delete,orEditcall.IfTrue,thechangesareforcedandchangesmadebyotherusersaresimplyoverwritten.IfFalse(default),changesmadebyanotheruserwhiletheupdateispendingwillcausetheupdatetofailforthosechangesthatareinconflict.Noerroroccurs,buttheBatchCollisionCountandBatchCollisionspropertieswillindicatethenumberofconflictsandtherows

Page 305: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

affectedbyconflicts,respectively(ODBCDirectworkspacesonly).

Settings

Youcanusethefollowingvaluesforthetypeargument.Youcanusethenon-defaultvaluesonlyifbatchupdatingisenabled.

Constant Description

dbUpdateRegular Default.Pendingchangesaren’tcachedandarewrittentodiskimmediately.

dbUpdateBatch Allpendingchangesintheupdatecachearewrittentodisk.

dbUpdateCurrentRecord Onlythecurrentrecord’spendingchangesarewrittentodisk.

Remarks

UseUpdatetosavethecurrentrecordandanychangesyou'vemadetoit.

CautionChangestothecurrentrecordarelostif:

YouusetheEditorAddNewmethod,andthenmovetoanotherrecordwithoutfirstusingUpdate.

YouuseEditorAddNew,andthenuseEditorAddNewagainwithoutfirstusingUpdate.

YousettheBookmarkpropertytoanotherrecord.

YoucloserecordsetwithoutfirstusingUpdate.

YoucanceltheEditoperationbyusingCancelUpdate.

Page 306: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Toeditarecord,usetheEditmethodtocopythecontentsofthecurrentrecordtothecopybuffer.Ifyoudon'tuseEditfirst,anerroroccurswhenyouuseUpdateorattempttochangeafield'svalue.

InanODBCDirectworkspace,youcandobatchupdates,providedthecursorlibrarysupportsbatchupdates,andtheRecordsetwasopenedwiththeoptimisticbatchlockingoption.

InaMicrosoftJetworkspace,whentheRecordsetobject'sLockEditspropertysettingisTrue(pessimisticallylocked)inamultiuserenvironment,therecordremainslockedfromthetimeEditisuseduntiltheUpdatemethodisexecutedortheeditiscanceled.IftheLockEditspropertysettingisFalse(optimisticallylocked),therecordislockedandcomparedwiththepre-editedrecordjustbeforeitisupdatedinthedatabase.IftherecordhaschangedsinceyouusedtheEditmethod,theUpdateoperationfails.MicrosoftJet-connectedODBCandinstallableISAMdatabasesalwaysuseoptimisticlocking.TocontinuetheUpdateoperationwithyourchanges,usetheUpdatemethodagain.Toreverttotherecordastheotheruserchangedit,refreshthecurrentrecordbyusingMove0.

NoteToadd,edit,ordeletearecord,theremustbeauniqueindexontherecordintheunderlyingdatasource.Ifnot,a“Permissiondenied”errorwilloccurontheAddNew,Delete,orEditmethodcallinaMicrosoftJetworkspace,oran“Invalidargument”errorwilloccurontheUpdatecallinanODBCDirectworkspace.

Page 307: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOPropertiesbyObject

ThisreferencegroupsallDAOpropertiesbyobjectorcollection.TodeterminewhetheraparticularpropertyisavailabletoMicrosoftJetorODBCdatabases,checktheHelptopicforthatproperty.

Connection

Container

Database

Parameter

Property

Page 308: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DBEngine

Document

Error

Field

QueryDef

Recordset

Relation

TableDef

Page 309: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Group

Index

User

Workspace

Page 310: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOPropertiesforMicrosoftJetWorkspaces

ThisreferencelistsalphabeticallyallDAOpropertiesavailabletoMicrosoftJetworkspaces.

Page 311: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

A-CAbsolutePosition

AllowZeroLength

AllPermissions

Attributes

BOF

Bookmark

Bookmarkable

CacheSize

CacheStart

Clustered

CollatingOrder

ConflictTable

Connect

Container

Count

Page 312: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

D-HDataUpdatable

DateCreated

DefaultUser

DefaultPassword

DefaultValue

Description

DesignMasterID

DistinctCount

EditMode

EOF

FieldSize

Filter

Foreign

ForeignName

ForeignTable

HelpContext

HelpFile

Page 313: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

I-OIgnoreNulls

Index

Inherit

Inherited

IniPath

IsolateODBCTrans

KeepLocal

LastModified

LastUpdated

LockEdits

LoginTimeout

LogMessages

MaxRecords

Name

NoMatch

Number

ODBCTimeout

OrdinalPosition

Owner

Page 314: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

P-RPartialReplicadaproPartialReplica>langref

Password

PercentPosition

Permissions

PID

Primary

QueryTimeout

RecordCount

RecordsAffected

Replicable

ReplicableBool

ReplicaFilter

ReplicaID

Required

Restartable

ReturnsRecords

Page 315: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

S-ZSize

Sort

Source

SourceField

SourceTable

SourceTableName

SQL

SystemDB

Table

Transactions

Type

Unique

Updatable

UserName

V1xNullBehavior

ValidateOnSet

ValidationRule

ValidationText

Value

Version

Page 316: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOPropertiesforODBCDirectWorkspaces

ThisreferencelistsalphabeticallyallDAOpropertiesavailabletoODBCDirectworkspaces.

Page 317: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

A-DAbsolutePosition

Attributes

BatchCollisionCount

BatchCollisions

BatchSize

BOF

Bookmark

Bookmarkable

CacheSize

Connect

Connection

Count

Database

DataUpdatable

DefaultCursorDriver

DefaultType

Description

Direction

Page 318: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

E-QEditMode

EOF

FieldSize

HelpContext

HelpFile

LastModified

LockEdits

LoginTimeout

LogMessages

MaxRecordsdaproMaxRecords>langref

Name

Number

ODBCTimeout

OrdinalPosition

OriginalValue

PercentPosition

Prepare

QueryTimeout

Page 319: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

R-ZRecordCount

RecordsAffected

RecordStatus

Restartable

Size

Source

SourceField

SourceTable

SQL

StillExecuting

Transactions

Type

Updatable

UpdateOptions

UserName

Value

Version

VisibleValue

Page 320: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AbsolutePositionProperty

SetsorreturnstherelativerecordnumberofaRecordsetobject'scurrentrecord.

SettingsandReturnValues

ThesettingorreturnvalueisaLongintegerfrom0toonelessthanthenumberofrecordsintheRecordsetobject.ItcorrespondstotheordinalpositionofthecurrentrecordintheRecordsetobjectspecifiedbytheobject.

Remarks

YoucanusetheAbsolutePositionpropertytopositionthecurrentrecordpointertoaspecificrecordbasedonitsordinalpositioninadynaset-orsnapshot-typeRecordsetobject.YoucanalsodeterminethecurrentrecordnumberbycheckingtheAbsolutePositionpropertysetting.

BecausetheAbsolutePositionpropertyvalueiszero-based(thatis,asettingof0referstothefirstrecordintheRecordsetobject),youcannotsetittoavaluegreaterthanorequaltothenumberofpopulatedrecords;

Page 321: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

doingsocausesatrappableerror.YoucandeterminethenumberofpopulatedrecordsintheRecordsetobjectbycheckingtheRecordCountpropertysetting.ThemaximumallowablesettingfortheAbsolutePositionpropertyisthevalueoftheRecordCountpropertyminus1.

Ifthereisnocurrentrecord,aswhentherearenorecordsintheRecordsetobject,AbsolutePositionreturns–1.Ifthecurrentrecordisdeleted,theAbsolutePositionpropertyvalueisn'tdefined,andatrappableerroroccursifit'sreferenced.Newrecordsareaddedtotheendofthesequence.

Youshouldn'tusethispropertyasasurrogaterecordnumber.BookmarksarestilltherecommendedwayofretainingandreturningtoagivenpositionandaretheonlywaytopositionthecurrentrecordacrossalltypesofRecordsetobjects.Inparticular,thepositionofarecordchangeswhenoneormorerecordsprecedingitaredeleted.ThereisalsonoassurancethatarecordwillhavethesameabsolutepositioniftheRecordsetobjectisre-createdagainbecausetheorderofindividualrecordswithinaRecordsetobjectisn'tguaranteedunlessit'screatedwithanSQLstatementbyusinganORDERBYclause.

Notes

SettingtheAbsolutePositionpropertytoavaluegreaterthanzeroonanewlyopenedbutunpopulatedRecordsetobjectcausesatrappableerror.PopulatetheRecordsetobjectfirstwiththeMoveLastmethod.

TheAbsolutePositionpropertyisn'tavailableonforward-only–typeRecordsetobjects,oronRecordsetobjectsopenedfrompass-throughqueriesagainstMicrosoftJet-connectedODBCdatabases.

Page 322: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AllowZeroLengthProperty

Setsorreturnsavaluethatindicateswhetherazero-lengthstring("")isavalidsettingfortheValuepropertyoftheFieldobjectwithaTextorMemodatatype(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaBooleandatatypethatindicatesifavalueisvalid.ThevalueisTrueiftheFieldobjectacceptsazero-lengthstringasitsValueproperty;thedefaultvalueisFalse.

Remarks

ForanobjectnotyetappendedtotheFieldscollection,thispropertyisread/write.

OnceappendedtoaFieldscollection,theavailabilityoftheAllowZeroLengthpropertydependsontheobjectthatcontainstheFieldscollection,asshowninthefollowingtable.

IftheFieldscollectionbelongstoan ThenAllowZeroLengthis

Page 323: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Indexobject NotsupportedQueryDefobject Read-onlyRecordsetobject Read-onlyRelationobject NotsupportedTableDefobject Read/write

YoucanusethispropertyalongwiththeRequired,ValidateOnSet,orValidationRulepropertytovalidateavalueinafield.

Page 324: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AllPermissionsProperty

ReturnsallthepermissionsthatapplytothecurrentUserNamepropertyoftheContainerorDocumentobject,includingpermissionsthatarespecifictotheuseraswellasthepermissionsauserinheritsfrommembershipsingroups(MicrosoftJetworkspacesonly).

ReturnValues

ForanyContainerorDocumentobject,thereturnvalueisaLongvalueorconstant(s)thatmayincludethefollowing.

Constant Description

dbSecReadDef Theusercanreadthetabledefinition,includingcolumnandindexinformation.

dbSecWriteDef Theusercanmodifyordeletethetabledefinition,includingcolumnandindexinformation.

dbSecRetrieveData TheusercanretrievedatafromtheDocumentobject.

dbSecInsertData Theusercanaddrecords.dbSecReplaceData Theusercanmodifyrecords.dbSecDeleteData Theusercandeleterecords.

Page 325: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Inaddition,theDatabasescontaineroranyDocumentobjectinaDocumentscollectionmayincludethefollowing.

Constant DescriptiondbSecDeleteData Theusercandeleterecords.

dbSecDBAdmin Theusercanreplicatethedatabaseandchangethedatabasepassword.

dbSecDBCreateTheusercancreatenewdatabases.ThissettingisvalidonlyontheDatabasescontainerintheworkgroupinformationfile(System.mdw).

dbSecDBExclusive Theuserhasexclusiveaccesstothedatabase.dbSecDBOpen Theusercanopenthedatabase.

Remarks

ThispropertycontrastswiththePermissionsproperty,whichreturnsonlythepermissionsthatarespecifictotheuseranddoesn'tincludeanypermissionsthattheusermayalsohaveasamemberofgroups.IfthecurrentvalueoftheUserNamepropertyisagroup,thentheAllPermissionspropertyreturnsthesamevaluesasthePermissionsproperty.

Page 326: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AttributesProperty

SetsorreturnsavaluethatindicatesoneormorecharacteristicsofaField,Relation,orTableDefobject.

SettingsandReturnValues

ThesettingorreturnvalueisLongdatatype,andthedefaultvalueis0.

ForaFieldobject,thevaluespecifiescharacteristicsofthefieldrepresentedbytheFieldobjectandcanbeacombinationoftheseconstants.

Constant Description

dbAutoIncrField

ThefieldvaluefornewrecordsisautomaticallyincrementedtoauniqueLongintegerthatcan'tbechanged(inaMicrosoftJetworkspace,supportedonlyforMicrosoftJetdatabase(.mdb)tables).

dbDescending

Thefieldissortedindescending(ZtoAor100to0)order;thisoptionappliesonlytoaFieldobjectinaFieldscollectionofanIndexobject.Ifyouomitthisconstant,thefieldissortedinascending(AtoZor0to

Page 327: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

100)order.ThisisthedefaultvalueforIndexandTableDeffields(MicrosoftJetworkspacesonly).

dbFixedField Thefieldsizeisfixed(defaultforNumericfields).

dbHyperlinkField Thefieldcontainshyperlinkinformation(Memofieldsonly).

dbSystemFieldThefieldstoresreplicationinformationforreplicas;youcan'tdeletethistypeoffield(MicrosoftJetworkspacesonly).

dbUpdatableField Thefieldvaluecanbechanged.dbVariableField Thefieldsizeisvariable(Textfieldsonly).

ForaRelationobject,thevaluespecifiescharacteristicsoftherelationshiprepresentedbytheRelationobjectandcanbeacombinationoftheseconstants.

Constant DescriptiondbRelationUnique Therelationshipisone-to-one.

dbRelationDontEnforce Therelationshipisn'tenforced(noreferentialintegrity).

dbRelationInherited Therelationshipexistsinanon-currentdatabasethatcontainsthetwolinkedtables.

dbRelationUpdateCascade Updateswillcascade.dbRelationDeleteCascade Deletionswillcascade.

dbRelationLeftMicrosoftAccessonly.InDesignview,displayaLEFTJOINasthedefaultjointype.

dbRelationRightMicrosoftAccessonly.InDesignview,displayaRIGHTJOINasthedefaultjointype.

NoteIfyousettheRelationobject'sAttributespropertytoactivatecascadingoperations,theMicrosoftJetdatabaseengineautomaticallyupdatesordeletesrecordsinoneormoreothertableswhenchangesoccurinrelatedprimarytables.

Forexample,supposeyouestablishacascadingdeleterelationship

Page 328: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

betweenaCustomerstableandanOrderstable.WhenyoudeleterecordsfromtheCustomerstable,recordsintheOrderstablerelatedtothatcustomerarealsodeleted.Inaddition,ifyouestablishcascadingdeleterelationshipsbetweentheOrderstableandothertables,recordsfromthosetablesareautomaticallydeletedwhenyoudeleterecordsfromtheCustomerstable.

ForaTableDefobject,thevaluespecifiescharacteristicsofthetablerepresentedbytheTableDefobjectandcanbeacombinationoftheseLongconstants.

Constant Description

dbAttachExclusive

FordatabasesthatusetheMicrosoftJetdatabaseengine,thetableisalinkedtableopenedforexclusiveuse.YoucansetthisconstantonanappendedTableDefobjectforalocaltable,butnotonaremotetable.

dbAttachSavePWD

FordatabasesthatusetheMicrosoftJetdatabaseengine,theuserIDandpasswordfortheremotelylinkedtablearesavedwiththeconnectioninformation.YoucansetthisconstantonanappendedTableDefobjectforaremotetable,butnotonalocaltable.

dbSystemObject

ThetableisasystemtableprovidedbytheMicrosoftJetdatabaseengine.YoucansetthisconstantonanappendedTableDefobject.

dbHiddenObject

ThetableisahiddentableprovidedbytheMicrosoftJetdatabaseengine.YoucansetthisconstantonanappendedTableDefobject.

dbAttachedTableThetableisalinkedtablefromanon-ODBCdatasourcesuchasaMicrosoftJetorParadoxdatabase(read-only).

dbAttachedODBCThetableisalinkedtablefromanODBCdatasource,suchasMicrosoftSQLServer(read-only).

Remarks

Page 329: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Foranobjectnotyetappendedtoacollection,thispropertyisread/write.

ForanappendedFieldobject,theavailabilityoftheAttributespropertydependsontheobjectthatcontainstheFieldscollection.

IftheFieldobjectbelongstoan ThenAttributesis

Indexobject

Read/writeuntiltheTableDefobjectthattheIndexobjectisappendedtoisappendedtoaDatabaseobject;thenthepropertyisread-only.

QueryDefobject Read-onlyRecordsetobject Read-onlyRelationobject NotsupportedTableDefobject Read/write

ForanappendedRelationobject,theAttributespropertysettingisread-only.

ForanappendedTableDefobject,thepropertyisread/write,althoughyoucan'tsetalloftheconstantsiftheobjectisappended,asnotedinSettingsandReturnValues.

Whenyousetmultipleattributes,youcancombinethembysummingtheappropriateconstants.Anyinvalidvaluesareignoredwithoutproducinganerror.

Page 330: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

BatchCollisionCountProperty

Returnsthenumberofrecordsthatdidnotcompletethelastbatchupdate(ODBCDirectworkspacesonly).

ReturnValue

ThereturnvalueisaLongthatindicatesthenumberoffailingrecords,or0ifallrecordsweresuccessfullyupdated.

Remarks

Thispropertyindicateshowmanyrecordsencounteredcollisionsorotherwisefailedtoupdateduringthelastbatchupdateattempt.ThevalueofthispropertycorrespondstothenumberofbookmarksintheBatchCollisionsproperty.

IfyousettheworkingRecordsetobject'sBookmarkpropertytobookmarkvaluesintheBatchCollisionsarray,youcanmovetoeachrecordthatfailedtocompletethemostrecentbatchUpdateoperation.

Afterthecollisionrecordsarecorrected,abatch-modeUpdatemethodcanbecalledagain.AtthispointDAOattemptsanotherbatchupdate,

Page 331: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

andtheBatchCollisionspropertyagainreflectsthesetofrecordsthatfailedthesecondattempt.Anyrecordsthatsucceededinthepreviousattemptarenotsentinthecurrentattempt,becausetheynowhaveaRecordStatuspropertyofdbRecordUnmodified.Thisprocesscancontinueaslongascollisionsoccur,oruntilyouabandontheupdatesandclosetheresultset.

Page 332: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

BatchCollisionsProperty

Returnsanarrayofbookmarksindicatingtherowsthatgeneratedcollisionsinthelastbatchupdateoperation(ODBCDirectworkspacesonly).

ReturnValue

Thereturnvalueisavariantexpressioncontaininganarrayofbookmarks.

Remarks

ThispropertycontainsanarrayofbookmarkstorowsthatencounteredacollisionduringthelastattemptedbatchUpdatecall.TheBatchCollisionCountpropertyindicatesthenumberofelementsinthearray.

IfyousettheworkingRecordsetobject'sBookmarkpropertytobookmarkvaluesintheBatchCollisionsarray,youcanmovetoeachrecordthatfailedtocompletethemostrecentbatch-modeUpdateoperation.

Afterthecollisionrecordsarecorrected,youcancallthebatchmode

Page 333: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Updatemethodagain.AtthispointDAOattemptsanotherbatchupdate,andtheBatchCollisionspropertyagainreflectsthesetofrecordsthatfailedthesecondattempt.Anyrecordsthatsucceededinthepreviousattemptarenotsentinthecurrentattempt,astheynowhaveaRecordStatuspropertyofdbRecordUnmodified.Thisprocesscancontinueaslongascollisionsoccur,oruntilyouabandontheupdatesandclosetheresultset.

Thisarrayisre-createdeachtimeyouexecuteabatch-modeUpdatemethod.

Page 334: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

BatchSizeProperty

Setsorreturnsthenumberofstatementssentbacktotheserverineachbatch(ODBCDirectworkspacesonly).

SettingsAndReturnValues

ThesettingorreturnvalueisaLongthatindicatesthenumberofbatchedstatementssenttheserverinasinglebatchupdate.Thedefaultvalueis15.

Remarks

TheBatchSizepropertydeterminesthebatchsizeusedwhensendingstatementstotheserverinabatchupdate.Thevalueofthepropertydeterminesthenumberofstatementssenttotheserverinonecommandbuffer.Bydefault,15statementsaresenttotheserverineachbatch.Thispropertycanbechangedatanytime.Ifadatabaseserverdoesn'tsupportstatementbatching,youcansetthispropertyto1,causingeachstatementtobesentseparately.

Page 335: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

BOF,EOFProperties

BOF?returnsavaluethatindicateswhetherthecurrentrecordpositionisbeforethefirstrecordinaRecordsetobject.

EOF?returnsavaluethatindicateswhetherthecurrentrecordpositionisafterthelastrecordinaRecordsetobject.

ReturnValues

ThereturnvaluesfortheBOFandEOFpropertiesareBooleanvalues.

TheBOFpropertyreturnsTrueifthecurrentrecordpositionisbeforethefirstrecord,andFalseifthecurrentrecordpositionisonorafterthefirstrecord.

TheEOFpropertyreturnsTrueifthecurrentrecordpositionisafterthelastrecord,andFalseifthecurrentrecordpositionisonorbeforethelastrecord.

Remarks

Page 336: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

YoucanusetheBOFandEOFpropertiestodeterminewhetheraRecordsetobjectcontainsrecordsorwhetheryou'vegonebeyondthelimitsofaRecordsetobjectwhenyoumovefromrecordtorecord.

ThelocationofthecurrentrecordpointerdeterminestheBOFandEOFreturnvalues.

IfeithertheBOForEOFpropertyisTrue,thereisnocurrentrecord.

IfyouopenaRecordsetobjectcontainingnorecords,theBOFandEOFpropertiesaresettoTrue,andtheRecordsetobject'sRecordCountpropertysettingis0.WhenyouopenaRecordsetobjectthatcontainsatleastonerecord,thefirstrecordisthecurrentrecordandtheBOFandEOFpropertiesareFalse;theyremainFalseuntilyoumovebeyondthebeginningorendoftheRecordsetobjectbyusingtheMovePreviousorMoveNextmethod,respectively.WhenyoumovebeyondthebeginningorendoftheRecordset,thereisnocurrentrecordornorecordexists.

IfyoudeletethelastremainingrecordintheRecordsetobject,theBOFandEOFpropertiesmayremainFalseuntilyouattempttorepositionthecurrentrecord.

IfyouusetheMoveLastmethodonaRecordsetobjectcontainingrecords,thelastrecordbecomesthecurrentrecord;ifyouthenusetheMoveNextmethod,thecurrentrecordbecomesinvalidandtheEOFpropertyissettoTrue.Conversely,ifyouusetheMoveFirstmethodonaRecordsetobjectcontainingrecords,thefirstrecordbecomesthecurrentrecord;ifyouthenusetheMovePreviousmethod,thereisnocurrentrecordandtheBOFpropertyissettoTrue.

Typically,whenyouworkwithalltherecordsinaRecordsetobject,yourcodewillloopthroughtherecordsbyusingtheMoveNextmethoduntiltheEOFpropertyissettoTrue.

IfyouusetheMoveNextmethodwhiletheEOFpropertyissettoTrueortheMovePreviousmethodwhiletheBOFpropertyissettoTrue,anerroroccurs.

Page 337: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ThistableshowswhichMovemethodsareallowedwithdifferentcombinationsoftheBOFandEOFproperties.

MoveFirst,MoveLast

MovePrevious,Move<0 Move0

MoveNext,Move>0

BOF=True,EOF=False Allowed Error Error Allowed

BOF=False,EOF=True Allowed Allowed Error Error

BothTrue Error Error Error ErrorBothFalse Allowed Allowed Allowed Allowed

AllowingaMovemethoddoesn'tmeanthatthemethodwillsuccessfullylocatearecord.ItmerelyindicatesthatanattempttoperformthespecifiedMovemethodisallowedandwon'tgenerateanerror.ThestateoftheBOFandEOFpropertiesmaychangeasaresultoftheattemptedMove.

AnOpenRecordsetmethodinternallyinvokesaMoveFirstmethod.Therefore,usinganOpenRecordsetmethodonanemptysetofrecordssetstheBOFandEOFpropertiestoTrue.(SeethefollowingtableforthebehaviorofafailedMoveFirstmethod.)

AllMovemethodsthatsuccessfullylocatearecordwillsetbothBOFandEOFtoFalse.

InaMicrosoftJetworkspace,ifyouaddarecordtoanemptyRecordset,BOFwillbecomeFalse,butEOFwillremainTrue,indicatingthatthecurrentpositionisattheendofRecordset.InanODBCDirectworkspace,bothBOFandEOFwillbecomeFalse,indicatingthatthecurrentpositionisonthenewrecord.

AnyDeletemethod,evenifitremovestheonlyremainingrecordfromaRecordset,won'tchangethesettingoftheBOForEOFproperty.

ThefollowingtableshowshowMovemethodsthatdon'tlocatearecordaffecttheBOFandEOFpropertysettings.

Page 338: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

BOF EOFMoveFirst,MoveLast True TrueMove0 Nochange NochangeMovePrevious,Move<0True NochangeMoveNext,Move>0 Nochange True

Page 339: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

BookmarkProperty

SetsorreturnsabookmarkthatuniquelyidentifiesthecurrentrecordinaRecordsetobject.

SettingsandReturnValues

Thesettingorreturnvalueisastringexpressionorvariantexpressionthatevaluatestoavalidbookmark.ThedatatypeisaVariantarrayofBytedata.

Remarks

ForaRecordsetobjectbasedentirelyonMicrosoftJettables,thevalueoftheBookmarkablepropertyisTrue,andyoucanusetheBookmarkpropertywiththatRecordset.Otherdatabaseproductsmaynotsupportbookmarks,however.Forexample,youcan'tusebookmarksinanyRecordsetobjectbasedonalinkedParadoxtablethathasnoprimarykey.

WhenyoucreateoropenaRecordsetobject,eachofitsrecordsalreadyhasauniquebookmark.YoucansavethebookmarkforthecurrentrecordbyassigningthevalueoftheBookmarkpropertytoavariable.To

Page 340: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

quicklyreturntothatrecordatanytimeaftermovingtoadifferentrecord,settheRecordsetobject'sBookmarkpropertytothevalueofthatvariable.

Thereisnolimittothenumberofbookmarksyoucanestablish.Tocreateabookmarkforarecordotherthanthecurrentrecord,movetothedesiredrecordandassignthevalueoftheBookmarkpropertytoaStringvariablethatidentifiestherecord.

TomakesuretheRecordsetobjectsupportsbookmarks,checkthevalueofitsBookmarkablepropertybeforeyouusetheBookmarkproperty.IftheBookmarkablepropertyisFalse,theRecordsetobjectdoesn'tsupportbookmarks,andusingtheBookmarkpropertyresultsinatrappableerror.

IfyouusetheClonemethodtocreateacopyofaRecordsetobject,theBookmarkpropertysettingsfortheoriginalandtheduplicateRecordsetobjectsareidenticalandcanbeusedinterchangeably.However,youcan'tusebookmarksfromdifferentRecordsetobjectsinterchangeably,eveniftheywerecreatedbyusingthesameobjectorthesameSQLstatement.

IfyousettheBookmarkpropertytoavaluethatrepresentsadeletedrecord,atrappableerroroccurs.

ThevalueoftheBookmarkpropertyisn'tthesameasarecordnumber.

Page 341: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

BookmarkableProperty

ReturnsavaluethatindicateswhetheraRecordsetobjectsupportsbookmarks,whichyoucansetbyusingtheBookmarkproperty.

ReturnValues

ThereturnvalueisaBooleandatatypethatreturnsTrueiftheobjectsupportsbookmarks.

Remarks

ChecktheBookmarkablepropertysettingofaRecordsetobjectbeforeyouattempttosetorchecktheBookmarkproperty.

ForRecordsetobjectsbasedentirelyonMicrosoftJettables,thevalueoftheBookmarkablepropertyisTrue,andyoucanusebookmarks.Otherdatabaseproductsmaynotsupportbookmarks,however.Forexample,youcan'tusebookmarksinanyRecordsetobjectbasedonalinkedParadoxtablethathasnoprimarykey.

Page 342: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CacheSizeProperty

SetsorreturnsthenumberofrecordsretrievedfromanODBCdatasourcethatwillbecachedlocally.

SettingsandReturnValues

ThesettingorreturnvalueisaLongvalueandmustbebetween5and1200,butnotgreaterthanavailablememorywillallow.Atypicalvalueis100.Asettingof0turnsoffcaching.

Remarks

DatacachingimprovesperformanceifyouuseRecordsetobjectstoretrievedatafromaremoteserver.Acacheisaspaceinlocalmemorythatholdsthedatamostrecentlyretrievedfromtheserver;thisisusefulifusersrequestthedataagainwhiletheapplicationisrunning.Whenusersrequestdata,theMicrosoftJetdatabaseenginechecksthecachefortherequesteddatafirstratherthanretrievingitfromtheserver,whichtakesmoretime.ThecacheonlysavesdatathatcomesfromanODBCdatasource.

AnyMicrosoftJet-connectedODBCdatasource,suchasalinkedtable,

Page 343: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

canhavealocalcache.Tocreatethecache,openaRecordsetobjectfromtheremotedatasource,settheCacheSizeandCacheStartproperties,andthenusetheFillCachemethod,orstepthroughtherecordsbyusingtheMovemethods.

AnODBCDirectworkspacecanusealocalcache.Tocreatethecache,settheCacheSizepropertyonaQueryDefobject.OnaRelationobject,CacheSizeisread-onlyanddependsonthevalueoftheQueryDefobject'sCacheSizeproperty.Youcan'tusetheCacheStartpropertyonFillCachemethodinanODBCDirectworkspace.InaMicrosoftJetworkspace,theCacheSizepropertyisnotavailableonaQueryDefobject.

YoucanbasetheCacheSizepropertysettingonthenumberofrecordsyourapplicationcanhandleatonetime.Forexample,ifyou'reusingaRecordsetobjectasthesourceofthedatatobedisplayedonscreen,youcouldsetitsCacheSizepropertyto20todisplay20recordsatonetime.

TheMicrosoftJetdatabaseenginerequestsrecordswithinthecacherangefromthecache,anditrequestsrecordsoutsidethecacherangefromtheserver.

Recordsretrievedfromthecachedon'treflectconcurrentchangesthatotherusersmadetothesourcedata.

Toforceanupdateofallthecacheddata,settheCacheSizepropertyoftheRecordsetobjectto0,re-setittothesizeofthecacheyouoriginallyrequested,andthenusetheFillCachemethod.

Page 344: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CacheStartProperty

Setsorreturnsavaluethatspecifiesthebookmarkofthefirstrecordinadynaset-typeRecordsetobjectcontainingdatatobelocallycachedfromanODBCdatasource(MicrosoftJetworkspacesonly).

SettingsAndReturnValues

ThesettingorreturnvalueisaStringthatspecifiesabookmark.

Remarks

Datacachingimprovestheperformanceofanapplicationthatretrievesdatafromaremoteserverthroughdynaset-typeRecordsetobjects.Acacheisaspaceinlocalmemorythatholdsthedatamostrecentlyretrievedfromtheserverintheeventthatthedatawillberequestedagainwhiletheapplicationisrunning.Whendataisrequested,theMicrosoftJetdatabaseenginechecksthecachefortherequesteddatafirstratherthanretrievingitfromtheserver,whichtakesmoretime.OnlydatafromanODBCdatasourcecanbesavedinthecache.

AnyMicrosoftJet-connectedODBCdatasource,suchasalinkedtable,canhavealocalcache.Tocreatethecache,openaRecordsetobject

Page 345: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

fromtheremotedatasource,settheCacheSizeandCacheStartproperties,andthenusetheFillCachemethodorstepthroughtherecordsusingtheMovemethods.

TheCacheStartpropertysettingisthebookmarkofthefirstrecordintheRecordsetobjecttobecached.YoucanusethebookmarkofanyrecordtosettheCacheStartproperty.Maketherecordyouwanttostartthecachethecurrentrecord,andsettheCacheStartpropertyequaltotheBookmarkproperty.

TheMicrosoftJetdatabaseenginerequestsrecordswithinthecacherangefromthecache,anditrequestsrecordsoutsidethecacherangefromtheserver.

Recordsretrievedfromthecachedon'treflectchangesmadeconcurrentlytothesourcedatabyotherusers.

Toforceanupdateofallthecacheddata,settheCacheSizepropertyoftheRecordsetobjectto0,setittothesizeofthecacheyouoriginallyrequested,andthenusetheFillCachemethod.

Page 346: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ClusteredProperty

SetsorreturnsavaluethatindicateswhetheranIndexobjectrepresentsaclusteredindexforatable(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaBooleandatatypethatisTrueiftheIndexobjectrepresentsaclusteredindex.

Remarks

SomeIISAMdesktopdatabaseformatsuseclusteredindexes.Aclusteredindexconsistsofoneormorenonkeyfieldsthat,takentogether,arrangeallrecordsinatableinapredefinedorder.Aclusteredindexprovidesefficientaccesstorecordsinatableinwhichtheindexvaluesmaynotbeunique.

TheClusteredpropertyisread/writeforanewIndexobjectnotyetappendedtoacollectionandread-onlyforanexistingIndexobjectinanIndexescollection.

Notes

Page 347: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MicrosoftJetdatabasesignoretheClusteredpropertybecausetheMicrosoftJetdatabaseenginedoesn'tsupportclusteredindexes.

ForODBCdatasourcestheClusteredpropertyalwaysreturnsFalse;itdoesnotdetectwhetherornottheODBCdatasourcehasaclusteredindex.

Page 348: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CollatingOrderProperty

Returnsavaluethatspecifiesthesequenceofthesortorderintextforstringcomparisonorsorting(MicrosoftJetworkspacesonly).

ReturnValues

ThereturnvalueisaLongvalueorconstantthatcanbeoneofthefollowingvalues.

Constant Sortorder

dbSortGeneral General(English,French,German,Portuguese,Italian,andModernSpanish)

dbSortArabic ArabicdbSortChineseSimplified SimplifiedChinesedbSortChineseTraditional TraditionalChinesedbSortCyrillic RussiandbSortCzech CzechdbSortDutch DutchdbSortGreek GreekdbSortHebrew HebrewdbSortHungarian HungariandbSortIcelandic Icelandic

Page 349: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbSortJapanese JapanesedbSortKorean KoreandbSortNeutral NeutraldbSortNorwDan NorwegianorDanishdbSortPDXIntl ParadoxInternationaldbSortPDXNor ParadoxNorwegianorDanishdbSortPDXSwe ParadoxSwedishorFinnishdbSortPolish PolishdbSortSlovenian SloveniandbSortSpanish SpanishdbSortSwedFin SwedishorFinnishdbSortThai ThaidbSortTurkish TurkishdbSortUndefined Undefinedorunknown

Remarks

TheavailabilityoftheCollatingOrderpropertydependsontheobjectthatcontainstheFieldscollection,asshowninthefollowingtable.

IftheFieldscollectionbelongstoanThenCollatingOrderisIndexobject NotsupportedQueryDefobject Read-onlyRecordsetobject Read-onlyRelationobject NotsupportedTableDefobject Read-only

TheCollatingOrderpropertysettingcorrespondstothelocaleargumentoftheCreateDatabasemethodwhenthedatabasewascreatedortheCompactDatabasemethodwhenthedatabasewasmostrecentlycompacted.

ChecktheCollatingOrderpropertysettingofaDatabaseorFieldobjecttodeterminethestringcomparisonmethodforthedatabaseorfield.YoucansettheCollatingOrderpropertyofanew,unappendedFieldobjectifyouwantthesettingoftheFieldobjecttodifferfromthatoftheDatabaseobjectthatcontainsit.

Page 350: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TheCollatingOrderandAttributespropertysettingsofaFieldobjectinaFieldscollectionofanIndexobjecttogetherdeterminethesequenceanddirectionofthesortorderinanindex.However,youcan'tsetacollatingorderforanindividualindex—youcanonlysetitforanentiretable.

Page 351: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ConflictTableProperty

Returnsthenameofaconflicttablecontainingthedatabaserecordsthatconflictedduringthesynchronizationoftworeplicas(MicrosoftJetworkspacesonly).

ReturnValues

ThereturnvalueisaStringdatatypethatisazero-lengthstringifthereisnoconflicttableorthedatabaseisn'tareplica.

Remarks

Iftwousersattwoseparatereplicaseachmakeachangetothesamerecordinthedatabase,thechangesmadebyoneuserwillfailtobeappliedtotheotherreplica.Consequently,theuserwiththefailedchangemustresolvetheconflicts.

Conflictsoccurattherecordlevel,notbetweenfields.Forexample,ifoneuserchangestheAddressfieldandanotherupdatesthePhonefieldinthesamerecord,thenonechangeisrejected.Becauseconflictsoccurattherecordlevel,therejectionoccurseventhoughthesuccessfulchangeandtherejectedchangeareunlikelytoresultinatrueconflictof

Page 352: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

information.

Thesynchronizationmechanismhandlestherecordconflictsbycreatingconflicttables,whichcontaintheinformationthatwouldhavebeenplacedinthetable,ifthechangehadbeensuccessful.Youcanexaminetheseconflicttablesandworkthroughthemrowbyrow,fixingwhateverisappropriate.

Allconflicttablesarenamedtable_conflict,wheretableistheoriginalnameofthetable,truncatedtothemaximumtablenamelength.

Page 353: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ConnectProperty

Setsorreturnsavaluethatprovidesinformationaboutthesourceofanopenconnection,anopendatabase,adatabaseusedinapass-throughquery,oralinkedtable.ForDatabaseobjects,newConnectionobjects,linkedtables,andTableDefobjectsnotyetappendedtoacollection,thispropertysettingisread/write.ForQueryDefobjectsandbasetables,thispropertyisread-only.

Syntax

object.Connect=databasetype;parameters;

TheConnectpropertysyntaxhastheseparts.

Part Description

object AnobjectexpressionthatevaluatestoanobjectintheAppliesTolist.

databasetypeOptional.AStringthatspecifiesadatabasetype.ForMicrosoftJetdatabases,excludethisargument;ifyouspecifyparameters,useasemicolon(;)asaplaceholder.

parametersOptional.AStringthatspecifiesadditionalparameterstopasstoODBCorinstallableISAMdrivers.Usesemicolonstoseparateparameters.

Page 354: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Settings

TheConnectpropertysettingisaStringcomposedofadatabasetypespecifierandzeroormoreparametersseparatedbysemicolons.TheConnectpropertypassesadditionalinformationtoODBCandcertainISAMdriversasneeded.

ToperformanSQLpass-throughqueryonatablelinkedtoyourMicrosoftJetdatabase(.mdb)file,youmustfirstsettheConnectpropertyofthelinkedtable'sdatabasetoavalidODBCconnectionstring.

ForaTableDefobjectthatrepresentsalinkedtable,theConnectpropertysettingconsistsofoneortwoparts(adatabasetypespecifierandapathtothedatabase),eachofwhichendswithasemicolon.

ThepathasshowninthefollowingtableisthefullpathforthedirectorycontainingthedatabasefilesandmustbeprecededbytheidentifierDATABASE=.Insomecases(aswithMicrosoftExcelandMicrosoftJetdatabases),youshouldincludeaspecificfilenameinthedatabasepathargument.

ThefollowingtableshowspossibledatabasetypesandtheircorrespondingdatabasespecifiersandpathsfortheConnectpropertysetting.InanODBCDirectworkspace,onlythe"ODBC"specifiercanbeused.

Databasetype Specifier ExampleMicrosoftJetDatabase [database]; drive:\path\filename.mdbdBASEIII dBASEIII; drive:\pathdBASEIV dBASEIV; drive:\pathdBASE5 dBASE5.0; drive:\pathParadox3.x Paradox3.x; drive:\pathParadox4.x Paradox4.x; drive:\pathParadox5.x Paradox5.x; drive:\pathMicrosoftFoxPro2.0 FoxPro2.0; drive:\pathMicrosoftFoxPro2.5 FoxPro2.5; drive:\pathMicrosoftFoxPro2.6 FoxPro2.6; drive:\pathMicrosoftVisual

Page 355: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

FoxPro3.0 FoxPro3.0; drive:\path

MicrosoftExcel3.0 Excel3.0; drive:\path\filename.xlsMicrosoftExcel4.0 Excel4.0; drive:\path\filename.xlsMicrosoftExcel5.0orMicrosoftExcel95 Excel5.0; drive:\path\filename.xls

MicrosoftExcel97 Excel8.0; drive:\path\filename.xlsLotus1-2-3WKSandWK1 LotusWK1; drive:\path\filename.wk1

Lotus1-2-3WK3 LotusWK3; drive:\path\filename.wk3Lotus1-2-3WK4 LotusWK4; drive:\path\filename.wk4HTMLImport HTMLImport; drive:\path\filenameHTMLExport HTMLExport; drive:\pathText Text; drive:\path

ODBC

ODBC;DATABASE=database;UID=user;PWD=password;DSN=datasourcename;[LOGINTIMEOUT=seconds;]

None

MicrosoftExchange

Exchange4.0;MAPILEVEL=folderpath;[TABLETYPE={0|1}];[PROFILE=profile;][PWD=password;][DATABASE=database;]

drive:\path\filename.mdb

Remarks

Ifthespecifierisonly"ODBC;",theODBCdriverdisplaysadialogboxlistingallregisteredODBCdatasourcenamessothattheusercanselectadatabase.

IfapasswordisrequiredbutnotprovidedintheConnectpropertysetting,alogindialogboxisdisplayedthefirsttimeatableisaccessedbytheODBCdriverandagainiftheconnectionisclosedandreopened.

FordatainMicrosoftExchange,therequiredMAPILEVELkeyshouldbe

Page 356: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

settoafully-resolvedfolderpath(forexample,"Mailbox-PatSmithIAlpha/Today").Thepathdoesnotincludethenameofthefolderthatwillbeopenedasatable;thatfolder’snameshouldinsteadbespecifiedasthenameargumenttotheCreateTablemethod.TheTABLETYPEkeyshouldbesetto"0"toopenafolder(default)or"1"toopenanaddressbook.ThePROFILEkeydefaultstotheprofilecurrentlyinuse.

ForbasetablesinaMicorosoftJetdatabase(.mdb),theConnectpropertysettingisazero-lengthstring("").

YoucansettheConnectpropertyforaDatabaseobjectbyprovidingasourceargumenttotheOpenDatabasemethod.Youcancheckthesettingtodeterminethetype,path,userID,password,orODBCdatasourceofthedatabase.

OnaQueryDefobjectinaMicrosoftJetworkspace,youcanusetheConnectpropertywiththeReturnsRecordspropertytocreateanODBCSQLpass-throughquery.Thedatabasetypeoftheconnectionstringis"ODBC;",andtheremainderofthestringcontainsinformationspecifictotheODBCdriverusedtoaccesstheremotedata.Formoreinformation,seethedocumentationforthespecificdriver.

Notes

YoumustsettheConnectpropertybeforeyousettheReturnsRecordsproperty.

Youmusthaveaccesspermissionstothecomputerthatcontainsthedatabaseserveryou'retryingtoaccess.

Page 357: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ConnectionProperty

OnaDatabaseobject,returnstheConnectionobjectthatcorrespondstothedatabase(ODBCDirectworkspacesonly).

OnaRecordsetobject,returnstheConnectionobjectthatownstheRecordset(ODBCDirectworkspacesonly).

SettingsAndReturnValues

ThereturnvalueisanobjectvariablethatrepresentstheConnection.OnaDatabaseobject,theConnectionpropertyisread-only,whileonaRecordsetobjectthepropertyisread-write.

Remarks

OnaDatabaseobject,usetheConnectionpropertytoobtainareferencetoaConnectionobjectthatcorrespondstotheDatabase.InDAO,aConnectionobjectanditscorrespondingDatabaseobjectaresimplytwodifferentobjectvariablereferencestothesameobject.TheDatabasepropertyofaConnectionobjectandtheConnectionpropertyofaDatabaseobjectmakeiteasiertochangeconnectionstoanODBCdatasourcethroughtheMicrosoftJetdatabaseenginetouse

Page 358: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCDirect.

Page 359: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ContainerProperty

ReturnsthenameoftheContainerobjecttowhichaDocumentobjectbelongs(MicrosoftJetworkspacesonly).

ReturnValues

ThereturnvalueisaStringdatatype.

Page 360: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

CountProperty

Returnsthenumberofobjectsinacollection.

ReturnValue

ThereturnvalueisanIntegerdatatype.

Remarks

Becausemembersofacollectionbeginwith0,youshouldalwayscodeloopsstartingwiththe0memberandendingwiththevalueoftheCountpropertyminus1.IfyouwanttoloopthroughthemembersofacollectionwithoutcheckingtheCountproperty,youcanuseaForEach...Nextcommand.

TheCountpropertysettingisneverNull.Ifitsvalueis0,therearenoobjectsinthecollection.

Page 361: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DatabaseProperty

ReturnstheDatabaseobjectthatcorrespondstothisconnection(ODBCDirectworkspacesonly).

ReturnValues

ThereturnvalueisanobjectvariablethatrepresentsaDatabaseobject.

Remarks

OnaConnectionobject,usetheDatabasepropertytoobtainareferencetoaDatabaseobjectthatcorrespondstotheConnection.InDAO,aConnectionobjectanditscorrespondingDatabaseobjectaresimplytwodifferentobjectvariablereferencestothesameobject.TheDatabasepropertyofaConnectionobjectandtheConnectionpropertyofaDatabaseobjectmakeiteasiertochangeconnectionstoanODBCdatasourcethroughtheMicrosoftJetdatabaseenginetouseODBCDirect.

Page 362: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DataUpdatableProperty

ReturnsavaluethatindicateswhetherthedatainthefieldrepresentedbyaFieldobjectisupdatable.

ReturnValues

ThereturnvalueisaBooleandatatypethatreturnsTrueifthedatainthefieldisupdatable.

Remarks

UsethispropertytodeterminewhetheryoucanchangetheValuepropertysettingofaFieldobject.ThispropertyisalwaysFalseonaFieldobjectwhoseAttributespropertyisdbAutoIncrField.

YoucanusetheDataUpdatablepropertyonFieldobjectsthatareappendedtotheFieldscollectionofQueryDef,Recordset,andRelationobjects,butnottheFieldscollectionofIndexorTableDefobjects.

Page 363: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DateCreated,LastUpdatedProperties

DateCreated?returnsthedateandtimethatanobjectwascreated,orthedateandtimeabasetablewascreatediftheobjectisatable-typeRecordsetobject(MicrosoftJetworkspacesonly).

LastUpdated?returnsthedateandtimeofthemostrecentchangemadetoanobject,ortoabasetableiftheobjectisatable-typeRecordsetobject(MicrosoftJetworkspacesonly).

ReturnValues

ThereturnvalueisaVariant(Date/Timesubtype).

Remarks

Fortable-typeRecordsetobjects,thedateandtimesettingsarederivedfromthecomputeronwhichthebasetablewascreatedorlastupdated.Forotherobjects,DateCreatedandLastUpdatedreturnthedateandtimethattheobjectwascreatedorlastupdated.Inamultiuserenvironment,usersshouldgetthesesettingsdirectlyfromthefileserver

Page 364: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

toavoiddiscrepanciesintheDateCreatedandLastUpdatedpropertysettings.

Page 365: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DefaultCursorDriverProperty

SetsorreturnsthetypeofcursordriverusedontheconnectioncreatedbytheOpenConnectionorOpenDatabasemethods(ODBCDirectworkspacesonly).

SettingsAndReturnValues

ThesettingorreturnvalueisaLongthatcanbesettooneofthefollowingconstants:

Constant Description

dbUseDefaultCursor(Default)Usesserver-sidecursorsiftheserversupportsthem;otherwiseusetheODBCCursorLibrary.

dbUseODBCCursor

AlwaysusestheODBCCursorLibrary.Thisoptionprovidesbetterperformanceforsmallresultsets,butdegradesquicklyforlargerresultsets.

dbUseServerCursor

Alwaysusesserver-sidecursors.Formostlargeoperationsthisoptionprovidesbetterperformance,butmightcausemorenetworktraffic.

dbUseClientBatchCursor Alwaysusestheclientbatchcursorlibrary.

Page 366: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Thisoptionisrequiredforbatchupdates.

dbUseNoCursor

Opensallcursors(thatis,Recordsetobjects)asforward-onlytype,read-only,witharowsetsizeof1.Alsoknownas"cursorlessqueries."

Remarks

Thispropertysettingonlyaffectsconnectionsestablishedafterthepropertyhasbeenset.ChangingtheDefaultCursorDriverpropertyhasnoeffectonexistingconnections.

Page 367: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DefaultTypeProperty

Setsorreturnsavaluethatindicateswhattypeofworkspace(MicrosoftJetorODBCDirect)willbeusedbythenextWorkspaceobjectcreated.

SettingsAndReturnValues

ThesettingorreturnvalueisaLongthatcanbesettoeitherofthefollowingconstants:

Constant Description

dbUseJet CreatesWorkspaceobjectsconnectedtotheMicrosoftJetdatabaseengine

dbUseODBC CreatesWorkspaceobjectsconnectedtoanODBCdatasource

Remarks

ThesettingcanbeoverriddenforasingleWorkspacebysettingthetypeargumenttotheCreateWorkspacemethod.

Page 368: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DefaultUser,DefaultPasswordProperties

DefaultUser?setstheusernameusedtocreatethedefaultWorkspacewhenitisinitialized.

DefaultPassword?setsthepasswordusedtocreatethedefaultWorkspacewhenitisinitialized.

Settings

ThesettingforDefaultUserisaStringdatatype.Itcanbe1–20characterslonginMicrosoftJetworkspacesandanylengthinODBCDirectworkspaces,anditcanincludealphabeticcharacters,accentedcharacters,numbers,spaces,andsymbolsexceptfor:"(quotationmarks),/(forwardslash),\(backslash),[](brackets),:(colon),|(pipe),<(less-thansign),>(greater-thansign),+(plussign),=(equalsign),;(semicolon),,(comma),?(questionmark),*(asterisk),leadingspaces,andcontrolcharacters(ASCII00toASCII31).

ThesettingforDefaultPasswordisaStringdatatypethatcanbeupto14characterslonginMicrosoftJetdatabasesandanylengthin

Page 369: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCDirectconnections.ItcancontainanycharacterexceptASCII0.

NoteUsestrongpasswordsthatcombineupper-andlowercaseletters,numbers,andsymbols.Weakpasswordsdon'tmixtheseelements.Strongpassword:Y6dh!et5.Weakpassword:House27.Useastrongpasswordthatyoucanremembersothatyoudon'thavetowriteitdown.

Bydefault,theDefaultUserpropertyissetto"admin"andtheDefaultPasswordpropertyissettoazero-lengthstring("").

Remarks

Usernamesaren'tusuallycase-sensitive;however,ifyou'rere-creatingauseraccountthatwasdeletedorcreatedinadifferentworkgroup,theusernamemustbeanexactcase-sensitivematchoftheoriginalname.Passwordsarecase-sensitive.

Typically,youusetheCreateWorkspacemethodtocreateaWorkspaceobjectwithagivenusernameandpassword.However,forbackwardcompatibilitywithearlierversionsandforconveniencewhenyoudon'timplementasecureddatabase,theMicrosoftJetdatabaseengineautomaticallycreatesadefaultWorkspaceobjectwhenneededifoneisn'talreadyopen.Inthiscase,theDefaultUserandDefaultPasswordpropertyvaluesdefinetheuserandpasswordforthedefaultWorkspaceobject.

Forthispropertytotakeeffect,youshouldsetitbeforecallinganyDAOmethods.

Page 370: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DefaultValueProperty

SetsorreturnsthedefaultvalueofaFieldobject.ForaFieldobjectnotyetappendedtotheFieldscollection,thispropertyisread/write(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringdatatypethatcancontainamaximumof255characters.Itcanbeeithertextoranexpression.Ifthepropertysettingisanexpression,itcan'tcontainuser-definedfunctions,MicrosoftJetdatabaseengineSQLaggregatefunctions,orreferencestoqueries,forms,orotherFieldobjects.

NoteYoucanalsosettheDefaultValuepropertyofaFieldobjectonaTableDefobjecttoaspecialvaluecalled"GenUniqueID()".Thiscausesarandomnumbertobeassignedtothisfieldwheneveranewrecordisaddedorcreated,therebygivingeachrecordauniqueidentifier.Thefield'sTypepropertymustbeLong.

Remarks

TheavailabilityoftheDefaultValuepropertydependsontheobjectthat

Page 371: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

containstheFieldscollection,asshowninthefollowingtable.

IftheFieldscollectionbelongstoanThenDefaultValueisIndexobject NotsupportedQueryDefobject Read-onlyRecordsetobject Read-onlyRelationobject NotsupportedTableDefobject Read/write

Whenanewrecordiscreated,theDefaultValuepropertysettingisautomaticallyenteredasthevalueforthefield.YoucanchangethefieldvaluebysettingitsValueproperty.

TheDefaultValuepropertydoesn'tapplytoAutoNumberandLongBinaryfields.

Page 372: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DescriptionProperty

Returnsadescriptivestringassociatedwithanerror.ThisisthedefaultpropertyfortheErrorobject.

ReturnValues

ThereturnvalueisaStringdatatypethatdescribestheerror.

Remarks

TheDescriptionpropertycomprisesashortdescriptionoftheerror.Usethispropertytoalerttheuseraboutanerrorthatyoucannotordonotwanttohandle.

Page 373: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DesignMasterIDProperty

Setsorreturnsa16-bytevaluethatuniquelyidentifiestheDesignMasterinareplicaset(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaGUIDthatuniquelyidentifiestheDesignMaster.

Remarks

YoushouldsettheDesignMasterIDpropertyonlyifyouneedtomovethecurrentDesignMaster.SettingthispropertymakesaspecificreplicainthereplicasettheDesignMaster.

CautionNevercreateasecondDesignMasterinareplicaset.TheexistenceofasecondDesignMastercanresultinthelossofdata.

Underextremecircumstances—forexample,iftheDesignMasteriserasedorcorrupted—youcansetthispropertyatthecurrentreplica.However,settingthispropertyatareplicawhenthereisalreadyanotherDesignMasterinthesetmightpartitionyourreplicasetintotwo

Page 374: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

irreconcilablesetsandpreventanyfurthersynchronizationofdata.

IfyoudecidetomakeareplicathenewDesignMasterfortheset,synchronizeitwithallthereplicasinthereplicasetbeforesettingtheDesignMasterIDpropertyinthereplica.ThereplicamustbeopeninexclusivemodeinordertomakeittheDesignMaster.

Ifyoumakeareplicathatisdesignatedread-onlyintotheDesignMaster,thetargetreplicaismaderead/write;theoldDesignMasteralsoremainsread/write.

TheDesignMasterIDpropertysettingisstoredintheMSysRepInfosystemtable.

Page 375: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DirectionProperty

SetsorreturnsavaluethatindicateswhetheraParameterobjectrepresentsaninputparameter,anoutputparameter,both,orthereturnvaluefromtheprocedure(ODBCDirectworkspacesonly).

SettingsAndReturnValues

ThesettingorreturnvalueisaLongthatcanbesettooneofthefollowingconstants:

Constant Description

dbParamInput (Default)Passesinformationtotheprocedure.

dbParamInputOutput Passesinformationbothtoandfromtheprocedure.

dbParamOutput ReturnsinformationfromtheprocedureasinanoutputparameterinSQL.

dbParamReturnValue Passesthereturnvaluefromaprocedure.

Remarks

UsetheDirectionpropertytodeterminewhethertheparameterisan

Page 376: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

inputparameter,outputparameter,both,orthereturnvaluefromtheprocedure.SomeODBCdriversdonotprovideinformationonthedirectionofparameterstoaSELECTstatementorprocedurecall.Inthesecases,itisnecessarytosetthedirectionpriortoexecutingthequery.

Forexample,thefollowingprocedurereturnsavaluefromastoredprocedurenamed"get_employees":

{?=callget_employees}

Thiscallproducesoneparameter—thereturnvalue.YouneedtosetthedirectionofthisparametertodbParamOutputordbParamReturnValuebeforeexecutingtheQueryDef.

YouneedtosetallparameterdirectionsexceptdbParamInputbeforeaccessingorsettingthevaluesoftheparametersandbeforeexecutingtheQueryDef.

YoushouldusedbParamReturnValueforreturnvalues,butincaseswherethatoptionisnotsupportedbythedriverortheserver,youcanusedbParamOutputinstead.

NoteTheMicrosoftSQLServer6.0driverautomaticallysetstheDirectionpropertyforallprocedureparameters.NotallODBCdriverscandeterminethedirectionofaqueryparameter.Inthesecases,itisnecessarytosetthedirectionpriortoexecutingthequery.

Page 377: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DistinctCountProperty

ReturnsavaluethatindicatesthenumberofuniquevaluesfortheIndexobjectthatareincludedintheassociatedtable(MicrosoftJetworkspacesonly).

ReturnValues

ThereturnvalueisaLongdatatype.

Remarks

ChecktheDistinctCountpropertytodeterminethenumberofuniquevalues,orkeys,inanindex.Anykeyiscountedonlyonce,eventhoughtheremaybemultipleoccurrencesofthatvalueiftheindexpermitsduplicatevalues.Thisinformationisusefulinapplicationsthatattempttooptimizedataaccessbyevaluatingindexinformation.ThenumberofuniquevaluesisalsoknownasthecardinalityofanIndexobject.

TheDistinctCountpropertywon'talwaysreflecttheactualnumberofkeysataparticulartime.Forexample,achangecausedbyarolledbacktransactionwon'tbereflectedimmediatelyintheDistinctCountproperty.TheDistinctCountpropertyvaluealsomaynotreflectthedeletionof

Page 378: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

recordswithuniquekeys.ThenumberwillbeaccurateimmediatelyafteryouusetheCreateIndexmethod.

Page 379: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

EditModeProperty

Returnsavaluethatindicatesthestateofeditingforthecurrentrecord.

ReturnValues

ThereturnvalueisaLongthatindicatesthestateofediting,aslistedinthefollowingtable.

Constant DescriptiondbEditNone Noeditingoperationisinprogress.

DbEditInProgress TheEditmethodhasbeeninvoked,andthecurrentrecordisinthecopybuffer.

dbEditAddTheAddNewmethodhasbeeninvoked,andthecurrentrecordinthecopybufferisanewrecordthathasn'tbeensavedinthedatabase.

Remarks

TheEditModepropertyisusefulwhenaneditingprocessisinterrupted,forexample,byanerrorduringvalidation.YoucanusethevalueoftheEditModepropertytodeterminewhetheryoushouldusetheUpdateorCancelUpdatemethod.

Page 380: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

YoucanalsochecktoseeiftheLockEditspropertysettingisTrueandtheEditModepropertysettingisdbEditInProgresstodeterminewhetherthecurrentpageislocked.

Page 381: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

FieldSizeProperty

Returnsthenumberofbytesusedinthedatabase(ratherthaninmemory)ofaMemoorLongBinaryFieldobjectintheFieldscollectionofaRecordsetobject.

ReturnValues

ThereturnvalueisaLongthatindicatesthenumberofcharacters(foraMemofield)orthenumberofbytes(foraLongBinaryfield).

Remarks

YoucanuseFieldSizewiththeAppendChunkandGetChunkmethodstomanipulatelargefields.

BecausethesizeofaLongBinaryorMemofieldcanexceed64K,youshouldassignthevaluereturnedbyFieldSizetoavariablelargeenoughtostoreaLongvariable.

TodeterminethesizeofaFieldobjectotherthanMemoandLongBinarytypes,usetheSizeproperty.

Page 382: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteInanODBCDirectworkspace,theFieldSizepropertyisnotavailableinthefollowingsituations:

IfthedatabaseserverorODBCdriverdoesnotsupportserver-sidecursors.

IfyouareusingtheODBCcursorlibrary(thatis,theDefaultCursorDriverpropertyissettodbUseODBC,ortodbUseDefaultwhentheserverdoesnotsupportserver-sidecursors).

Ifyouareusingacursorlessquery(thatis,theDefaultCursorDriverpropertyissettodbUseNoCursor).

Forexample,MicrosoftSQLServerversion4.21doesnotsupportserver-sidecursors,sotheFieldSizepropertyisnotavailable.

TheFieldSizepropertyandtheVBALen()orLenB()functionsmayreturndifferentvaluesasthelengthofthesamestring.StringsarestoredinaMicrosoftJetdatabaseinmulti-bytecharacterset(MBCS)form,butexposedthroughVBAinUnicodeformat.Asaresult,theLen()functionwillalwaysreturnthenumberofcharacters,LenBwillalwaysreturnthenumberofcharactersX2(Unicodeusestwobytesforeachcharacter),butFieldSizewillreturnsomevalueinbetweenifthestringhasanyMBCScharacters.Forexample,givenastringconsistingofthreenormalcharactersandtwoMBCScharacters,Len()willreturn5,LenB()willreturn10,andFieldSizewillreturn7,thesumof1foreachnormalcharacterand2foreachMBCScharacter.

Page 383: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

FilterProperty

SetsorreturnsavaluethatdeterminestherecordsincludedinasubsequentlyopenedRecordsetobject(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringdatatypethatcontainstheWHEREclauseofanSQLstatementwithoutthereservedwordWHERE.

Remarks

UsetheFilterpropertytoapplyafiltertoadynaset-,snapshot-,orforward-only–typeRecordsetobject.

YoucanusetheFilterpropertytorestricttherecordsreturnedfromanexistingobjectwhenanewRecordsetobjectisopenedbasedonanexistingRecordsetobject.

Inmanycases,it'sfastertoopenanewRecordsetobjectbyusinganSQLstatementthatincludesaWHEREclause.

UsetheU.S.dateformat(month-day-year)whenyoufilterfields

Page 384: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

containingdates,evenifyou'renotusingtheU.S.versionoftheMicrosoftJetdatabaseengine(inwhichcaseyoumustassembleanydatesbyconcatenatingstrings,forexample,strMonth&"-"&strDay&"-"&strYear).Otherwise,thedatamaynotbefilteredasyouexpect.

Ifyousetthepropertytoastringconcatenatedwithanon-integervalue,andthesystemparametersspecifyanon-U.S.decimalcharactersuchasacomma(forexample,strFilter="PRICE>"&lngPrice,andlngPrice=125,50),anerroroccurswhenyoutrytoopenthenextRecordset.Thisisbecauseduringconcatenation,thenumberwillbeconvertedtoastringusingyoursystem'sdefaultdecimalcharacter,andMicrosoftJetSQLonlyacceptsU.S.decimalcharacters.

Page 385: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ForeignProperty

ReturnsavaluethatindicateswhetheranIndexobjectrepresentsaforeignkeyinatable(MicrosoftJetworkspacesonly).

ReturnValues

ThereturnvalueisaBooleandatatypethatreturnsTrueiftheIndexobjectrepresentsaforeignkey.

Remarks

Aforeignkeyconsistsofoneormorefieldsinaforeigntablethatuniquelyidentifyallrowsinaprimarytable.

TheMicrosoftJetdatabaseenginecreatesanIndexobjectfortheforeigntableandsetstheForeignpropertywhenyoucreatearelationshipthatenforcesreferentialintegrity.

Page 386: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ForeignNameProperty

SetsorreturnsavaluethatspecifiesthenameoftheFieldobjectinaforeigntablethatcorrespondstoafieldinaprimarytableforarelationship(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringdatatypethatevaluatestothenameofaFieldintheassociatedTableDefobject'sFieldscollection.

IftheRelationobjectisn'tappendedtotheDatabase,buttheFieldisappendedtotheRelationobject,theForeignNamepropertyisread/write.OncetheRelationobjectisappendedtothedatabase,theForeignNamepropertyisread-only.

Remarks

OnlyaFieldobjectthatbelongstotheFieldscollectionofaRelationobjectcansupporttheForeignNameproperty.

TheNameandForeignNamepropertysettingsforaFieldobjectspecifythenamesofthecorrespondingfieldsintheprimaryandforeigntablesof

Page 387: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

arelationship.TheTableandForeignTablepropertysettingsforaRelationobjectdeterminetheprimaryandforeigntablesofarelationship.

Forexample,ifyouhadalistofvalidpartcodes(inafieldnamedPartNo)storedinaValidPartstable,youcouldestablisharelationshipwithanOrderItemtablesuchthatifapartcodewereenteredintotheOrderItemtable,itwouldhavetoalreadyexistintheValidPartstable.Ifthepartcodedidn'texistintheValidPartstableandyouhadnotsettheAttributespropertyoftheRelationobjecttodbRelationDontEnforce,atrappableerrorwouldoccur.

Inthiscase,theValidPartstableistheforeigntable,sotheForeignTablepropertyoftheRelationobjectwouldbesettoValidPartsandtheTablepropertyoftheRelationobjectwouldbesettoOrderItem.TheNameandForeignNamepropertiesoftheFieldobjectintheRelationobject'sFieldscollectionwouldbesettoPartNo.

Thefollowingillustrationdepictstherelationdescribedabove.

Page 388: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ForeignTableProperty

Setsorreturnsthenameoftheforeigntableinarelationship(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringdatatypethatevaluatestothenameofatableintheDatabaseobject'sTableDefscollection.Thispropertyisread/writeforanewRelationobjectnotyetappendedtoacollectionandread-onlyforanexistingRelationobjectintheRelationscollection.

Remarks

TheForeignTablepropertysettingofaRelationobjectistheNamepropertysettingoftheTableDeforQueryDefobjectthatrepresentstheforeigntableorquery;theTablepropertysettingistheNamepropertysettingoftheTableDeforQueryDefobjectthatrepresentstheprimarytableorquery.

Forexample,ifyouhadalistofvalidpartcodes(inafieldnamedPartNo)storedinaValidPartstable,youcouldestablisharelationship

Page 389: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

withanOrderItemtablesuchthatifapartcodewereenteredintotheOrderItemtable,itwouldhavetoalreadybeintheValidPartstable.Ifthepartcodedidn'texistintheValidPartstableandyouhadnotsettheAttributespropertyoftheRelationobjecttodbRelationDontEnforce,atrappableerrorwouldoccur.

Inthiscase,theValidPartstableistheprimarytable,sotheTablepropertyoftheRelationobjectwouldbesettoValidPartsandtheForeignTablepropertyoftheRelationobjectwouldbesettoOrderItem.TheNameandForeignNamepropertiesoftheFieldobjectintheRelationobject'sFieldscollectionwouldbesettoPartNo.

Thefollowingillustrationdepictstherelationdescribedabove.

Page 390: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IgnoreNullsProperty

SetsorreturnsavaluethatindicateswhetherrecordsthathaveNullvaluesintheirindexfieldshaveindexentries(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaBooleanthatisTrueifthefieldswithNullvaluesdon'thaveanindexentry.Thispropertyisread/writeforanewIndexobjectnotyetappendedtoacollectionandread-onlyforanexistingIndexobjectinanIndexescollection.

Remarks

Tospeeduptheprocessofsearchingforrecords,youcandefineanindexforafield.IfyouallowNullentriesinanindexedfieldandexpectmanyoftheentriestobeNull,youcansettheIgnoreNullspropertyfortheIndexobjecttoTruetoreducetheamountofstoragespacethattheindexuses.

TheIgnoreNullspropertysettingandtheRequiredpropertysettingtogetherdeterminewhetherarecordwithaNullindexvaluehasanindex

Page 391: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

entry.

IfIgnoreNullsis AndRequiredis Then

True FalseANullvalueisallowedintheindexfield;noindexentryadded.

False FalseANullvalueisallowedintheindexfield;indexentryadded.

TrueorFalse TrueANullvalueisn'tallowedintheindexfield;noindexentryadded.

Page 392: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IndexProperty

SetsorreturnsavaluethatindicatesthenameofthecurrentIndexobjectinatable-typeRecordsetobject(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringdatatypethatevaluatestothenameofanIndexobjectintheIndexescollectionoftheTabledefortable-typeRecordsetobject'sTableDefobject.

Remarks

Recordsinbasetablesaren'tstoredinanyparticularorder.SettingtheIndexpropertychangestheorderofrecordsreturnedfromthedatabase;itdoesn'taffecttheorderinwhichtherecordsarestored.

ThespecifiedIndexobjectmustalreadybedefined.IfyousettheIndexpropertytoanIndexobjectthatdoesn'texistoriftheIndexpropertyisn'tsetwhenyouusetheSeekmethod,atrappableerroroccurs.

ExaminetheIndexescollectionofaTableDefobjecttodeterminewhatIndexobjectsareavailabletotable-typeRecordsetobjectscreatedfrom

Page 393: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

thatTableDefobject.

YoucancreateanewindexforthetablebycreatinganewIndexobject,settingitsproperties,appendingittotheIndexescollectionoftheunderlyingTableDefobject,andthenreopeningtheRecordsetobject.

Recordsreturnedfromatable-typeRecordsetobjectcanbeorderedonlybytheindexesdefinedfortheunderlyingTableDefobject.Tosortrecordsinsomeotherorder,youcanopenadynaset-,snapshot-,orforward-only–typeRecordsetobjectbyusinganSQLstatementwithanORDERBYclause.

Notes

Youdon'thavetocreateindexesfortables.Withlarge,unindexedtables,accessingaspecificrecordorcreatingaRecordsetobjectcantakealongtime.Ontheotherhand,creatingtoomanyindexesslowsdownupdate,append,anddeleteoperationsbecauseallindexesareautomaticallyupdated.

Recordsreadfromtableswithoutindexesarereturnedinnoparticularsequence.

TheAttributespropertyofeachFieldobjectintheIndexobjectdeterminestheorderofrecordsandconsequentlydeterminestheaccesstechniquestouseforthatindex.

Auniqueindexhelpsoptimizefindingrecords.

Indexesdon'taffectthephysicalorderofabasetable?indexesaffectonlyhowtherecordsareaccessedbythetable-typeRecordsetobjectwhenaparticularindexischosenorwhen

Page 394: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Recordsetisopened.

Page 395: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

InheritProperty

SetsorreturnsavaluethatindicateswhethernewDocumentobjectswillinheritadefaultPermissionspropertysetting(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaBooleandatatype.IfyousetthepropertytoTrue,DocumentobjectsinheritadefaultPermissionspropertysetting.

Remarks

UsetheInheritpropertyinconjunctionwiththePermissionspropertytodefinewhatpermissionsnewdocumentswillautomaticallyhavewhenthey'recreated.IfyousettheInheritpropertytoTrue,andthensetapermissiononacontainer,thenwheneveranewdocumentiscreatedinthatcontainer,thatpermissionwillbesetonthenewdocument.Thisisaveryconvenientwayofpresettingpermissionsonanobject.

SettingtheInheritpropertywillnotaffectexistingdocumentsinthecontainer?youcan'tmodifyallthepermissionsonallexistingdocuments

Page 396: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

inacontainerbysettingtheInheritpropertyandanewpermission.ItwillaffectonlynewdocumentsthatarecreatedaftertheInheritpropertyisset.

Page 397: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

InheritedProperty

ReturnsavaluethatindicateswhetheraPropertyobjectisinheritedfromanunderlyingobject.

ReturnValues

ThereturnvalueisaBooleandatatypethatisTrueifthePropertyobjectisinherited.Forbuilt-inPropertyobjectsthatrepresentpredefinedproperties,theonlypossiblereturnvalueisFalse.ThispropertyisalwaysFalseinanODBCDirectworkspace.

Remarks

YoucanusetheInheritedpropertytodeterminewhetherauser-definedPropertywascreatedfortheobjectitappliesto,orwhetherthePropertywasinheritedfromanotherobject.Forexample,supposeyoucreateanewPropertyforaQueryDefobjectandthenopenaRecordsetobjectfromtheQueryDefobject.ThisnewPropertywillbepartoftheRecordsetobject'sPropertiescollection,anditsInheritedpropertywillbesettoTruebecausethepropertywascreatedfortheQueryDefobject,nottheRecordsetobject.

Page 398: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IniPathProperty

SetsorreturnsinformationabouttheWindowsRegistrykeythatcontainsvaluesfortheMicrosoftJetdatabaseengine(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringdatatypethatpointstoauser-suppliedportionoftheWindowsRegistrykeycontainingMicrosoftJetdatabaseenginesettingsorparametersneededforinstallableISAMdatabases.

Remarks

YoucanconfiguretheMicrosoftJetenginewiththeWindowsRegistry.YoucanusetheRegistrytosetoptions,suchasinstallableISAMDLLs.

Forthisoptiontohaveanyeffect,youmustsettheIniPathpropertybeforeyourapplicationinvokesanyotherDAOcode.Thescopeofthissettingislimitedtoyourapplicationandcan'tbechangedwithoutrestartingyourapplication.

Page 399: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

YoualsousetheRegistrytoprovideinitializationparametersforsomeinstallableISAMdatabasedrivers.Forexample,touseParadoxversion4.0,settheIniPathpropertytoapartoftheRegistrycontainingtheappropriateparameters.

ThispropertyrecognizeseitherHKEY_LOCAL_MACHINEorHKEY_LOCAL_USER.Ifnorootkeyissupplied,thedefaultisHKEY_LOCAL_MACHINE.

MicrosoftJetversions2.5orearlierkeptinitializationinformationin.inifiles.

Page 400: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

IsolateODBCTransProperty

SetsorreturnsavaluethatindicateswhethermultipletransactionsthatinvolvethesameMicrosoftJet-connectedODBCdatasourceareisolated(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaBooleandatatypethatisTrueifyouwanttoisolatetransactionsinvolvingthesameODBC(OpenDatabaseConnectivity)connection.False(thedefault)willallowmultipletransactionsinvolvingthesameODBCconnection.

Remarks

Insomesituations,youneedtohavemultiplesimultaneoustransactionspendingonthesameODBCconnection.Todothis,youneedtoopenaseparateWorkspaceforeachtransaction.AlthougheachWorkspacecanhaveitsownODBCconnectiontothedatabase,thisslowssystemperformance.Becausetransactionisolationisn'tusuallyrequired,ODBCconnectionsfrommultipleWorkspaceobjectsopenedbythesameuseraresharedbydefault.

Page 401: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SomeODBCservers,suchasMicrosoftSQLServer,don'tallowsimultaneoustransactionsonasingleconnection.Ifyouneedtohavemorethanonetransactionatatimependingagainstsuchadatabase,settheIsolateODBCTranspropertytoTrueoneachWorkspaceassoonasyouopenit.ThisforcesaseparateODBCconnectionforeachWorkspace.

Page 402: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

KeepLocalProperty

Setsorreturnsavalueonatable,query,form,report,macro,ormodulethatyoudonotwanttoreplicatewhenthedatabaseisreplicated(MicrosoftJetworkspacesonly).

NoteBeforegettingorsettingtheKeepLocalpropertyonaTableDef,orQueryDefobject,youmustcreateitbyusingtheCreatePropertymethodandappendittothePropertiescollectionfortheobject.

SettingsandReturnValues

ThesettingorreturnvalueisaTextdatatype.Ifyousetthispropertyto"T",theobjectwillremainlocalwhenthedatabaseisreplicated.Youcan'tusetheKeepLocalpropertyonobjectsaftertheyhavebeenreplicated.

Remarks

OnceyousettheKeepLocalproperty,itwillappearinthePropertiescollectionfortheDocumentobjectrepresentingthehostobject.

BeforesettingtheKeepLocalproperty,youshouldcheckthevalueofthe

Page 403: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Replicableproperty.

Afteryoumakeadatabasereplicable,allnewobjectscreatedwithintheDesignMaster,orinanyotherreplicasintheset,arelocalobjects.Localobjectsremaininthereplicainwhichthey'recreatedandaren'tcopiedthroughoutthereplicaset.Eachtimeyoumakeanewreplicaintheset,thenewreplicacontainsallthereplicableobjectsfromthesourcereplica,butnoneofthelocalobjectsfromthesourcereplica.

Ifyoucreateanewobjectinareplicaandwanttochangeitfromlocaltoreplicablesothatalluserscanuseit,youcaneithercreatetheobjectinorimportitintotheDesignMaster.Besuretodeletethelocalobjectfromanyreplicas;otherwise,youwillencounteradesignerror.AftertheobjectispartoftheDesignMaster,settheobject'sReplicablepropertytoTrue.

TheobjectonwhichyouaresettingtheKeepLocalpropertymighthavealreadyinheritedthatpropertyfromanotherobject.However,thevaluesetbytheotherobjecthasnoeffectonthebehavioroftheobjectyouwanttokeeplocal.Youmustexplicitlysetthepropertyforeachobject.

Page 404: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

LastModifiedProperty

Returnsabookmarkindicatingthemostrecentlyaddedorchangedrecord.

ReturnValues

ThereturnvalueisaVariantarrayofBytedata.

Remarks

YoucanusetheLastModifiedpropertytomovetothemostrecentlyaddedorupdatedrecord.UsetheLastModifiedpropertywithtable-anddynaset-typeRecordsetobjects.ArecordmustbeaddedormodifiedintheRecordsetobjectitselfinorderfortheLastModifiedpropertytohaveavalue.

Page 405: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

LockEditsProperty

Setsorreturnsavalueindicatingthetypeoflockingthatisineffectwhileediting.

SettingsandReturnValues

ThesettingorreturnvalueisaBooleanthatindicatesthetypeoflocking,asspecifiedinthefollowingtable.

Value Description

True

Default.Pessimisticlockingisineffect.The2Kpagecontainingtherecordyou'reeditingislockedassoonasyoucalltheEditmethod.

FalseOptimisticlockingisineffectforediting.The2KpagecontainingtherecordisnotlockeduntiltheUpdatemethodisexecuted.

Remarks

YoucanusetheLockEditspropertywithupdatableRecordsetobjects.

Ifapageislocked,nootherusercaneditrecordsonthesamepage.If

Page 406: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

yousetLockEditstoTrueandanotheruseralreadyhasthepagelocked,anerroroccurswhenyouusetheEditmethod.Otheruserscanreaddatafromlockedpages.

IfyousettheLockEditspropertytoFalseandlaterusetheUpdatemethodwhileanotheruserhasthepagelocked,anerroroccurs.Toseethechangesmadetoyourrecordbyanotheruser,usetheMovemethodwith0astheargument;however,ifyoudothis,youwillloseyourchanges.

WhenworkingwithMicrosoftJet-connectedODBCdatasources,theLockEditspropertyisalwayssettoFalse,oroptimisticlocking.TheMicrosoftJetdatabaseenginehasnocontroloverthelockingmechanismsusedinexternaldatabaseservers.

NoteYoucanpresetthevalueofLockEditswhenyoufirstopentheRecordsetbysettingthelockeditsargumentoftheOpenRecordsetmethod.SettingthelockeditsargumenttodbPessimisticwillsettheLockEditspropertytoTrue,andsettinglockeditstoanyothervaluewillsettheLockEditspropertytoFalse.

Page 407: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

LoginTimeoutProperty

SetsorreturnsthenumberofsecondsbeforeanerroroccurswhenyouattempttologontoanODBCdatabase.

SettingsandReturnValues

ThesettingorreturnvalueisanIntegerrepresentingthenumberofsecondsbeforealogintimeouterroroccurs.ThedefaultLoginTimeoutpropertysettingis20seconds.WhentheLoginTimeoutpropertyissetto0,notimeoutoccurs.

Remarks

Whenyou'reattemptingtologontoanODBCdatabase,suchasMicrosoftSQLServer,theconnectioncanfailasaresultofnetworkerrorsorbecausetheserverisn'trunning.Ratherthanwaitingforthedefault20secondstoconnect,youcanspecifyhowlongtowaitbeforeraisinganerror.Loggingontotheserverhappensimplicitlyaspartofanumberofdifferentevents,suchasrunningaqueryonanexternalserverdatabase.

YoucanuseLoginTimeoutontheDBEngineobjectinbothMicrosoftJet

Page 408: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

andODBCDirectworkspaces.YoucanuseLoginTimeoutontheWorkspaceobjectonlyinODBCDirectworkspaces.Settingthepropertyto-1onaWorkspacewilldefaulttothecurrentsettingofDBEngine.LoginTimeout.YoucanchangethispropertyinaWorkspaceatanytime,andthenewsettingwilltakeeffectwiththenextConnectionorDatabaseobjectopened.

ThedefaultvalueisdeterminedbytheODBCdriver.InaMicrosoftJetworkspace,youcanoverridethedriver’sdefaultvaluebycreatinganew“ODBC”keyintheRegistrypath\HKEY_LOCAL_MACHINE\SOFTWARE\Jet\3.5\,creatingaLoginTimeoutparameterinthiskey,andsettingthevalueasdesired.

Page 409: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

LogMessagesProperty

SetsorreturnsavaluethatspecifiesifthemessagesreturnedfromaMicrosoftJet-connectedODBCdatasourcearerecorded(MicrosoftJetworkspacesonly).

NoteBeforeyoucansetorgetthevalueoftheLogMessagesproperty,youmustcreatetheLogMessagespropertywiththeCreatePropertymethod,andappendittothePropertiescollectionofaQueryDefobject.

SettingsandReturnValues

ThesettingorreturnvalueisaBooleanthatisTrueifODBC-generatedmessagesarerecorded.

Remarks

Somepass-throughqueriescanreturnmessagesinadditiontodata.IfyousettheLogMessagespropertytoTrue,theMicrosoftJetdatabaseenginecreatesatablethatcontainsreturnedmessages.Thetablenameistheusernameconcatenatedwithahyphen(-)andasequentialnumberstartingat00.Forexample,becausethedefaultusernameis

Page 410: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Admin,thetablesreturnedwouldbenamedAdmin-00,Admin-01,andsoon.

Ifyouexpectthequerytoreturnmessages,createandappendauser-definedLogMessagespropertyfortheQueryDefobject,andsetitstypetoBooleananditsvaluetoTrue.

Onceyou'veprocessedtheresultsfromthesetables,youmaywanttodeletethemfromthedatabasealongwiththetemporaryqueryusedtocreatethem.

Page 411: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MaxRecordsProperty

SetsorreturnsthemaximumnumberofrecordstoreturnfromaqueryagainstanODBCdatasource.

SettingsAndReturnValues

ThesettingorreturnvalueisaLongthatrepresentsthenumberofrecordstobereturned.Thedefaultvalueis0,indicatingnolimitonthenumberofrecordsreturned.

Remarks

OncethenumberofrowsspecifiedbyMaxRecordsisreturnedtoyourapplicationinaRecordset,thequeryprocessorwillstopreturningadditionalrecordsevenifmorerecordswouldqualifyforinclusionintheRecordset.Thispropertyisusefulinsituationswherelimitedclientresourcesprohibitmanagementoflargenumbersofrecords.

NoteTheMaxRecordspropertycanonlybeusedwithanODBCdatasource,connectedthrougheitheraMicrosoftJetorODBCDirectworkspace.

Page 412: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NameProperty

Setsorreturnsauser-definednameforaDAOobject.Foranobjectnotappendedtoacollection,thispropertyisread/write.

SettingsandReturnValues

ThesettingorreturnvalueisaStringthatspecifiesaname.Thenamemuststartwithaletter.ThemaximumnumberofcharactersdependsonthetypeofobjectNameappliesto,asshowninRemarks.Itcanincludenumbersandunderscorecharacters(_)butcan'tincludepunctuationorspaces.

Remarks

TableDef,QueryDef,Field,Index,User,andGroupobjectscan'tsharethesamenamewithanyobjectinthesamecollection.

TheNamepropertyofaRecordsetobjectopenedbyusinganSQLstatementisthefirst256charactersoftheSQLstatement.

Youcanuseanobject'sNamepropertywiththeVisualBasicforApplicationsDimstatementincodetocreateotherinstancesofthe

Page 413: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

object.

NoteFormanyoftheDAOobjects,theNamepropertyreflectsthenameasknowntotheDatabaseobject,asinthenameofaTableDef,Field,orQueryDefobject.ThereisnodirectlinkbetweenthenameoftheDAOobjectandtheobjectvariableusedtoreferenceit.

Theread/writeusageoftheNamepropertydependsonthetypeofobjectitappliesto,andwhetherornottheobjecthasbeenappendedtoacollection.InanODBCDirectworkspace,theNamepropertyofanappendedobjectisalwaysread-only.ThefollowingtableindicateswhethertheNamepropertyinaMicrosoftJetworkspaceisread/writeorread-onlyforanobjectthatisappendedtoacollection(unlessotherwisenoted),andalsoindicatesitsmaximumlengthincaseswhereitisread/write.

Object Usage MaximumlengthContainer Read-onlyConnection Read-onlyDatabase Read-onlyDocument Read-onlyFieldUnappended Read/write 64AppendedtoIndex Read-onlyAppendedtoQueryDef Read-onlyAppendedtoRecordset Read-onlyAppendedtoTableDef(native) Read/write 64AppendedtoTableDef(linked)Read-onlyAppendedtoRelation Read-onlyGroupUnappended Read/write 20Appended Read-onlyIndexUnappended Read/write 64Appended Read-onlyParameter Read-onlyProperty

Page 414: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Unappended Read/write 64Appended Read-onlyBuilt-in Read-onlyQueryDefUnappended Read/write 64Temporary Read-onlyAppended Read/write 64Recordset Read-onlyRelationUnappended Read/write 64Appended Read-onlyTableDef Read/write 64UserUnappended Read/write 20Appended Read-onlyWorkspaceUnappended Read/write 20Appended Read-only

Page 415: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoMatchProperty

IndicateswhetheraparticularrecordwasfoundbyusingtheSeekmethodoroneoftheFindmethods(MicrosoftJetworkspacesonly).

ReturnValues

ThereturnvalueisaBooleanthatisTrueifthedesiredrecordwasnotfound.WhenyouopenorcreateaRecordsetobject,itsNoMatchpropertyissettoFalse.

Remarks

Tolocatearecord,usetheSeekmethodonatable-typeRecordsetobjectoroneoftheFindmethodsonadynaset-orsnapshot-typeRecordsetobject.ChecktheNoMatchpropertysettingtoseewhethertherecordwasfound.

IftheSeekorFindmethodisunsuccessfulandtheNoMatchpropertyisTrue,thecurrentrecordwillnolongerbevalid.Besuretoobtainthecurrentrecord'sbookmarkbeforeusingtheSeekmethodoraFindmethodifyou'llneedtoreturntothatrecord.

Page 416: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteUsinganyoftheMovemethodsonaRecordsetobjectwon'taffectitsNoMatchpropertysetting.

Page 417: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NumberProperty

Returnsanumericvaluespecifyinganerror.

ReturnValues

ThereturnvalueisaLongdatatypethatrepresentsanerrornumber.

Remarks

UsetheNumberpropertytodeterminetheerrorthatoccurred.Thevalueofthepropertycorrespondstoauniquetrapnumberthatcorrespondstoanerrorcondition.Foracompletelistofalltrapnumbersanderrorconditions,seeTrappableMicrosoftJetandDAOErrors.

Page 418: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCTimeoutProperty

IndicatesthenumberofsecondstowaitbeforeatimeouterroroccurswhenaQueryDefisexecutedonanODBCdatabase.

SettingsandReturnValues

ThesettingorreturnvalueisanIntegerrepresentingthenumberofsecondstowaitbeforeatimeouterroroccurs.

WhentheODBCTimeoutpropertyissetto-1,thetimeoutdefaultstothecurrentsettingoftheQueryTimeoutpropertyoftheConnectionorDatabaseobjectthatcontainstheQueryDef.WhentheODBCTimeoutpropertyissetto0,notimeouterroroccurs.

Remarks

Whenyou'reusinganODBCdatabase,suchasMicrosoftSQLServer,delayscanoccurbecauseofnetworktrafficorheavyuseoftheODBCserver.Ratherthanwaitingindefinitely,youcanspecifyhowlongtowaitbeforereturninganerror.

SettingtheODBCTimeoutpropertyofaQueryDefobjectoverridesthe

Page 419: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

valuespecifiedbytheQueryTimeoutpropertyoftheConnectionorDatabaseobjectcontainingtheQueryDef,butonlyforthatQueryDefobject.

NoteInanODBCDirectworkspace,aftersettingODBCTimeouttoanexplicitvalueyoucanresetitbacktothedefault(i.e.,-1)onlyonceduringthelifeoftheQueryDefobject.Otherwise,anerrorwilloccur.

Page 420: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

OrdinalPositionProperty

SetsorreturnstherelativepositionofaFieldobjectwithinaFieldscollection.ForanobjectnotyetappendedtotheFieldscollection,thispropertyisread/write.

SettingsandReturnValues

ThesettingorreturnvalueisanIntegerthatspecifiesthenumericorderoffields.Thedefaultis0.

Remarks

TheavailabilityoftheOrdinalPositionpropertydependsontheobjectthatcontainstheFieldscollection,asshowninthefollowingtable.

IftheFieldscollectionbelongstoaThenOrdinalPositionisIndexobject NotsupportedQueryDefobject Read-onlyRecordsetobject Read-onlyRelationobject NotsupportedTableDefobject Read/write

Page 421: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Generally,theordinalpositionofanobjectthatyouappendtoacollectiondependsontheorderinwhichyouappendtheobject.Thefirstappendedobjectisinthefirstposition(0),thesecondappendedobjectisinthesecondposition(1),andsoon.Thelastappendedobjectisinordinalpositioncount–1,wherecountisthenumberofobjectsinthecollectionasspecifiedbytheCountpropertysetting.

YoucanusetheOrdinalPositionpropertytospecifyanordinalpositionfornewFieldobjectsthatdiffersfromtheorderinwhichyouappendthoseobjectstoacollection.Thisenablesyoutospecifyafieldorderforyourtables,queries,andrecordsetswhenyouusetheminanapplication.Forexample,theorderinwhichfieldsarereturnedinaSELECT*queryisdeterminedbythecurrentOrdinalPositionpropertyvalues.

YoucanpermanentlyresettheorderinwhichfieldsarereturnedinrecordsetsbysettingtheOrdinalPositionpropertytoanypositiveinteger.

TwoormoreFieldobjectsinthesamecollectioncanhavethesameOrdinalPositionpropertyvalue,inwhichcasetheywillbeorderedalphabetically.Forexample,ifyouhaveafieldnamedAgesetto4andyousetasecondfieldnamedWeightto4,WeightisreturnedafterAge.

Youcanspecifyanumberthatisgreaterthanthenumberoffieldsminus1.Thefieldwillbereturnedinanorderrelativetothelargestnumber.Forexample,ifyousetafield'sOrdinalPositionpropertyto20(andthereareonly5fields)andyou'vesettheOrdinalPositionpropertyfortwootherfieldsto10and30,respectively,thefieldsetto20isreturnedbetweenthefieldssetto10and30.

NoteEveniftheFieldscollectionofaTableDefhasnotbeenrefreshed,thefieldorderinaRecordsetopenedfromtheTableDefwillreflecttheOrdinalPositiondataoftheTableDefobject.Atable-typeRecordsetwillhavethesameOrdinalPositiondataastheunderlyingtable,butanyothertypeofRecordsetwillhavenewOrdinalPositiondata(startingwith0)thatfollowtheorderdeterminedbytheOrdinalPositiondataoftheTableDef.

Page 422: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

OriginalValueProperty

ReturnsthevalueofaFieldinthedatabasethatexistedwhenthelastbatchupdatebegan(ODBCDirectworkspacesonly).

ReturnValues

Thereturnvalueisavariantexpression.

Remarks

Duringanoptimisticbatchupdate,acollisionmayoccurwhereasecondclientmodifiesthesamefieldandrecordinbetweenthetimethefirstclientretrievesthedataandthefirstclient'supdateattempt.TheOriginalValuepropertycontainsthevalueofthefieldatthetimethelastbatchUpdatebegan.IfthisvaluedoesnotmatchthevalueactuallyinthedatabasewhenthebatchUpdateattemptstowritetothedatabase,acollisionoccurs.Whenthishappens,thenewvalueinthedatabasewillbeaccessiblethroughtheVisibleValueproperty.

Page 423: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

OwnerProperty

Setsorreturnsavaluethatspecifiestheowneroftheobject(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringthatevaluatestoeitherthenameofaUserobjectintheUserscollectionorthenameofaGroupobjectintheGroupscollection.

Remarks

Theownerofanobjecthascertainaccessprivilegesdeniedtootherusers.Anyindividualuseraccount(representedbyaUserobject)orgroupofuseraccounts(representedbyaGroupobject)canchangetheOwnerpropertysettingatanytimeifithastheappropriatepermissions.

Page 424: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PartialReplicaProperty

SetsorreturnsavalueonaRelationobjectindicatingwhetherthatrelationshouldbeconsideredwhenpopulatingapartialreplicafromafullreplica.(MicrosoftJetdatabasesonly.)

SettingsandReturnValues

ThesettingorreturnvalueisaBooleandatatypethatisTruewhentherelationshouldbeenforcedduringsynchronization.

Remarks

Thispropertyenablesyoutoreplicatedatafromthefullreplicatothepartialreplicabasedonrelationshipsbetweentables.YoucanusethePartialReplicapropertywhensettingtheReplicaFilterpropertyalonecan'tadequatelyspecifywhatdatashouldbereplicatedtothepartial.Forexample,supposeyouhaveadatabaseinwhichtheCustomerstablehasaone-to-manyrelationshipwiththeOrderstable,andyouwanttoconfigureapartialreplicathatonlyreplicatesordersfromcustomersintheCaliforniaregion(insteadofallorders).ItisnotpossibletosettheReplicaFilterpropertyontheOrderstabletoRegion='CA'becausetheRegionfieldisintheCustomerstable,nottheOrderstable.

Page 425: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ToreplicateallordersfromtheCaliforniaregion,youmustindicatethattherelationbetweentheOrdersandCustomerstableswillbeactiveduringreplication.Onceyou'vecreatedapartialreplica,thefollowingstepswillpopulateitwithallordersfromtheCaliforniaregion:

1. SettheReplicaFilterpropertyontheCustomersTableDefobjectto"Region='CA'".

2. SetthevalueofthePartialReplicapropertytoTrueontheRelationobjectcorrespondingtotherelationshipbetweenOrdersandCustomers.

3. InvokethePopulatePartialmethod.

CautionWhenyousetareplicafilterorreplicarelation,beawarethatrecordsinthepartialreplicathatdon'tsatisfytherestrictioncriteriawillberemovedfromthepartialreplica,butnotfromthefullreplica.Forexample,supposeyousettheReplicaFilterpropertyontheCustomersTableDefinthepartialreplicato"Region='CA'"andyouthenrepopulatethedatabase.ThiswillinsertorupdateallrecordsforCalifornia-basedcustomers.IfyouthenresettheReplicaFilterpropertyto"Region='FL'"andrepopulatethedatabase,allCaliforniaregionrecordsinthepartialreplicawillberemoved,andallrecordsfromFlorida-basedcustomerswillbeinsertedfromthefullreplica.Norecordsinthefullreplicawillbedeleted.

BeforesettingeithertheReplicaFilterorPartialReplicaproperty,it'sagoodideatosynchronizethepartialreplicainwhichyouaresettingthesepropertieswiththefullreplica.Thiswillensurethatpendingchangesinthepartialreplicawillbemergedintothefullreplicabeforeanyrecordsareremovedinthepartialreplica.

Page 426: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PasswordProperty

Setsthepasswordforauseraccount(MicrosoftJetworkspacesonly).

NoteUsestrongpasswordsthatcombineupper-andlowercaseletters,numbers,andsymbols.Weakpasswordsdon'tmixtheseelements.Strongpassword:Y6dh!et5.Weakpassword:House27.Useastrongpasswordthatyoucanremembersothatyoudon'thavetowriteitdown.

Settings

ThesettingisaStringthatcanbeupto14characterslongandcanincludeanycharactersexcepttheASCIIcharacter0(null).Thispropertysettingiswrite-onlyfornewobjectsnotyetappendedtoacollection,andisnotavailableforexistingobjects.

Remarks

SetthePasswordpropertyalongwiththePIDpropertywhenyoucreateanewUserobject.

UsetheNewPasswordmethodtochangethePasswordpropertysettingforanexistingUserobject.Toclearapassword,setthenewpassword

Page 427: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

argumentoftheNewPasswordmethodtoazero-lengthstring("").

Passwordsarecase-sensitive.

NoteIfyoudon'thaveaccesspermission,youcan'tchangethepasswordofanyotheruser.

Page 428: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PercentPositionProperty

SetsorreturnsavalueindicatingtheapproximatelocationofthecurrentrecordintheRecordsetobjectbasedonapercentageoftherecordsintheRecordset.

SettingsandReturnValues

ThesettingorreturnvalueisaSinglethatisanumberbetween0.0and100.00.

Remarks

ToindicateorchangetheapproximatepositionofthecurrentrecordinaRecordsetobject,youcancheckorsetthePercentPositionproperty.Whenworkingwithadynaset-orsnapshot-typeRecordsetobjectopeneddirectlyfromabasetable,firstpopulatetheRecordsetobjectbymovingtothelastrecordbeforeyousetorcheckthePercentPositionproperty.IfyouusethePercentPositionpropertybeforefullypopulatingtheRecordsetobject,theamountofmovementisrelativetothenumberofrecordsaccessedasindicatedbytheRecordCountpropertysetting.YoucanmovetothelastrecordbyusingtheMoveLastmethod.

Page 429: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteUsingthePercentPositionpropertytomovethecurrentrecordtoaspecificrecordinaRecordsetobjectisn'trecommended?theBookmarkpropertyisbettersuitedforthistask.

OnceyousetthePercentPositionpropertytoavalue,therecordattheapproximatepositioncorrespondingtothatvaluebecomescurrent,andthePercentPositionpropertyisresettoavaluethatreflectstheapproximatepositionofthecurrentrecord.Forexample,ifyourRecordsetobjectcontainsonlyfiverecords,andyousetitsPercentPositionpropertyvalueto77,thevaluereturnedfromthePercentPositionpropertymaybe80,not77.

ThePercentPositionpropertyappliestoalltypesofRecordsetobjectsexceptforforward-only–typeRecordsetobjectsorRecordsetobjectsopenedfrompass-throughqueriesagainstremotedatabases.

YoucanusethePercentPositionpropertywithascrollbaronaformortextboxtoindicatethelocationofthecurrentrecordinaRecordsetobject.

Page 430: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PermissionsProperty

SetsorreturnsavaluethatestablishesthepermissionsfortheuserorgroupidentifiedbytheUserNamepropertyofaContainerorDocumentobject(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaLongconstantthatestablishespermissions.ThefollowingtableslistthevalidconstantsforthePermissionspropertyofvariousDAOobjects.Unlessotherwisenoted,allconstantsshowninalltablesarevalidforDocumentobjects.

ThefollowingtablelistspossiblevaluesforContainerobjectsotherthanTablesandDatabasescontainers.

Constant Description

dbSecNoAccess Theuserdoesn'thaveaccesstotheobject(notvalidforDocumentobjects).

dbSecFullAccess Theuserhasfullaccesstotheobject.dbSecDelete Theusercandeletetheobject.

dbSecReadSec Theusercanreadtheobject'ssecurity-relatedinformation.

Page 431: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbSecWriteSec Theusercanalteraccesspermissions.

dbSecWriteOwner TheusercanchangetheOwnerpropertysetting.

ThefollowingtablesliststhepossiblesettingsandreturnvaluesfortheTablescontainer.

Constant Description

dbSecCreate Theusercancreatenewdocuments(notvalidforDocumentobjects).

dbSecReadDef Theusercanreadthetabledefinition,includingcolumnandindexinformation.

dbSecWriteDefTheusercanmodifyordeletethetabledefinition,includingcolumnandindexinformation.

dbSecRetrieveData TheusercanretrievedatafromtheDocumentobject.

dbSecInsertData Theusercanaddrecords.dbSecReplaceData Theusercanmodifyrecords.dbSecDeleteData Theusercandeleterecords.

ThefollowingtablesliststhepossiblesettingsandreturnvaluesfortheDatabasescontainer.

Constant Description

dbSecDBAdminTheusercanreplicateadatabaseandchangethedatabasepassword(notvalidforDocumentobjects).

dbSecDBCreate

Theusercancreatenewdatabases.ThisoptionisvalidonlyontheDatabasescontainerintheworkgroupinformationfile(Systen.mdw).Thisconstantisn'tvalidforDocumentobjects.

dbSecDBExclusive Theuserhasexclusiveaccesstothedatabase.

dbSecDBOpen Theusercanopenthedatabase.

Page 432: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Remarks

Usethispropertytoestablishordeterminethetypeofread/writepermissionstheuserhasforaContainerorDocumentobject.

ADocumentobjectinheritsthepermissionsforusersfromitsContainerobject,providedtheInheritpropertyoftheContainerobjectissetforthoseusersorforagrouptowhichtheusersbelong.BysettingaDocumentobject'sPermissionsandUserNamepropertieslater,youcanfurtherrefinetheaccesscontrolbehaviorofyourobject.

Ifyouwanttosetorreturnpermissionsforauserthatincludespermissionsinheritedfromanygroupstowhichtheuserbelongs,usetheAllPermissionsproperty.

Page 433: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PIDProperty

Setsthepersonalidentifier(PID)foreitheragrouporauseraccount(MicrosoftJetworkspacesonly).

Settings

ThesettingisaStringcontaining4-20alphanumericcharacters.Thispropertysettingiswrite-onlyfornewobjectsnotyetappendedtoacollection,andisnotavailableforexistingobjects.

Remarks

SetthePIDpropertyalongwiththeNamepropertywhenyoucreateanewGroupobject.SetthePIDpropertyalongwiththeNameandPasswordpropertieswhenyoucreateanewUserobject.

Page 434: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PrepareProperty

Setsorreturnsavaluethatindicateswhetherthequeryshouldbepreparedontheserverasatemporarystoredprocedure,usingtheODBCSQLPrepareAPIfunction,priortoexecution,orjustexecutedusingtheODBCSQLExecDirectAPIfunction(ODBCDirectworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaLongvaluethatcanbeoneofthefollowingconstants:

Constant Description

dbQPrepare (Default)Thestatementisprepared(thatis,theODBCSQLPrepareAPIiscalled).

dbQUnprepare Thestatementisnotprepared(thatis,theODBCSQLExecDirectAPIiscalled).

Remarks

YoucanusethePreparepropertytoeitherhavetheservercreateatemporarystoredprocedurefromyourqueryandthenexecuteit,orjust

Page 435: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

havethequeryexecuteddirectly.BydefaultthePreparepropertyissettodbQPrepare.However,youcansetthispropertytodbQUnpreparetoprohibitpreparingofthequery.Inthiscase,thequeryisexecutedusingtheSQLExecDirectAPI.

Creatingastoredprocedurecanslowdowntheinitialoperation,butincreasesperformanceofallsubsequentreferencestothequery.However,somequeriescannotbeexecutedintheformofstoredprocedures.Inthesecases,youmustsetthePreparepropertytodbQUnprepare.

IfPrepareissettodbQPrepare,thiscanbeoverriddenwhenthequeryisexecutedbysettingtheExecutemethod'soptionsargumenttodbExecDirect.

NoteTheODBCSQLPrepareAPIiscalledassoonastheDAOSQLpropertyisset.Therefore,ifyouwanttoimproveperformanceusingthedbQUnprepareoption,youmustsetthePreparepropertybeforesettingtheSQLproperty.

Page 436: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

PrimaryProperty

SetsorreturnsavaluethatindicateswhetheranIndexobjectrepresentsaprimarykeyindexforatable(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaBooleanthatisTrueiftheIndexobjectrepresentsaprimarykeyindex.

ThePrimarypropertysettingisread/writeforanewIndexobjectnotyetappendedtoacollectionandread-onlyforanexistingIndexobjectinanIndexescollection.IftheIndexobjectisappendedtotheTableDefobjectbuttheTableDefobjectisn'tappendedtotheTableDefscollection,theIndexpropertyisread/write.

Remarks

Aprimarykeyindexconsistsofoneormorefieldsthatuniquelyidentifyallrecordsinatableinapredefinedorder.Becausetheindexfieldmustbeunique,theUniquepropertyoftheIndexobjectissettoTrue.Iftheprimarykeyindexconsistsofmorethanonefield,eachfieldcancontainduplicatevalues,buteachcombinationofvaluesfromalltheindexed

Page 437: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

fieldsmustbeunique.Aprimarykeyindexconsistsofakeyforthetableandusuallycontainsthesamefieldsastheprimarykey.

NoteYoudon'thavetocreateindexesfortables,butinlarge,unindexedtables,accessingaspecificrecordcantakealongtime.TheAttributespropertyofeachFieldobjectintheIndexobjectdeterminestheorderofrecordsandconsequentlydeterminestheaccesstechniquestouseforthatindex.Whenyoucreateanewtableinyourdatabase,it'sagoodideatocreateanindexononeormorefieldsthatuniquelyidentifyeachrecord,andthensetthePrimarypropertyoftheIndexobjecttoTrue.

Whenyousetaprimarykeyforatable,theprimarykeyisautomaticallydefinedastheprimarykeyindexforthetable.

Page 438: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

QueryTimeoutProperty

SetsorreturnsavaluethatspecifiesthenumberofsecondstowaitbeforeatimeouterroroccurswhenaqueryisexecutedonanODBCdatasource.

SettingsandReturnValues

ThesettingorreturnvalueisanIntegerrepresentingthenumberofsecondstowait.Thedefaultvalueis60.

Remarks

Whenyou'reusinganODBCdatabase,suchasMicrosoftSQLServer,theremaybedelaysduetonetworktrafficorheavyuseoftheODBCserver.Ratherthanwaitingindefinitely,youcanspecifyhowlongtowait.

WhenyouuseQueryTimeoutwithaConnectionorDatabaseobject,itspecifiesaglobalvalueforallqueriesassociatedwiththedatabase.YoucanoverridethisvalueforaspecificquerybysettingtheODBCTimeoutpropertyoftheparticularQueryDefobject.

InaMicrosoftJetworkspace,youcanoverridethedefaultvalueby

Page 439: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

creatinganew“ODBC”keyintheRegistrypath\HKEY_LOCAL_MACHINE\SOFTWARE\Jet\3.5\,creatingaQueryTimeoutparameterinthiskey,andsettingthevalueasdesired.

Page 440: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RecordCountProperty

ReturnsthenumberofrecordsaccessedinaRecordsetobject,orthetotalnumberofrecordsinatable-typeRecordsetorTableDefobject.

ReturnValues

ThereturnvalueisaLongdatatype.

Remarks

UsetheRecordCountpropertytofindouthowmanyrecordsinaRecordsetorTableDefobjecthavebeenaccessed.TheRecordCountpropertydoesn'tindicatehowmanyrecordsarecontainedinadynaset-,snapshot-,orforward-only–typeRecordsetobjectuntilallrecordshavebeenaccessed.Oncethelastrecordhasbeenaccessed,theRecordCountpropertyindicatesthetotalnumberofundeletedrecordsintheRecordsetorTableDefobject.Toforcethelastrecordtobeaccessed,usetheMoveLastmethodontheRecordsetobject.YoucanalsouseanSQLCountfunctiontodeterminetheapproximatenumberofrecordsyourquerywillreturn.

NoteUsingtheMoveLastmethodtopopulateanewlyopened

Page 441: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Recordsetnegativelyimpactsperformance.UnlessitisnecessarytohaveanaccurateRecordCountassoonasyouopenaRecordset,it'sbettertowaituntilyoupopulatetheRecordsetwithotherportionsofcodebeforecheckingtheRecordCountproperty.

Asyourapplicationdeletesrecordsinadynaset-typeRecordsetobject,thevalueoftheRecordCountpropertydecreases.However,recordsdeletedbyotherusersaren'treflectedbytheRecordCountpropertyuntilthecurrentrecordispositionedtoadeletedrecord.IfyouexecuteatransactionthataffectstheRecordCountpropertysettingandyousubsequentlyrollbackthetransaction,theRecordCountpropertywon'treflecttheactualnumberofremainingrecords.

TheRecordCountpropertyofasnapshot-orforward-only–typeRecordsetobjectisn'taffectedbychangesintheunderlyingtables.

ARecordsetorTableDefobjectwithnorecordshasaRecordCountpropertysettingof0.

WhenyouworkwithlinkedTableDefobjects,theRecordCountpropertysettingisalways–1.

UsingtheRequerymethodonaRecordsetobjectresetstheRecordCountpropertyjustasifthequerywerere-executed.

Page 442: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RecordsAffectedProperty

ReturnsthenumberofrecordsaffectedbythemostrecentlyinvokedExecutemethod.

ReturnValues

ThereturnvalueisaLongfrom0tothenumberofrecordsaffectedbythemostrecentlyinvokedExecutemethodoneitheraDatabaseorQueryDefobject.

Remarks

WhenyouusetheExecutemethodtorunanactionqueryfromaQueryDefobject,theRecordsAffectedpropertywillcontainthenumberofrecordsdeleted,updated,orinserted.

WhenyouuseRecordsAffectedinanODBCDirectworkspace,itwillnotreturnausefulvaluefromanSQLDROPTABLEactionquery.

Page 443: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RecordStatusProperty

Returnsavalueindicatingtheupdatestatusofthecurrentrecordifitispartofabatchupdate(ODBCDirectworkspacesonly).

ReturnValues

ThereturnvalueisaLongthatcanbeanyofthefollowingconstants:

Constant Description

dbRecordUnmodified (Default)Therecordhasnotbeenmodifiedorhasbeenupdatedsuccessfully.

dbRecordModified Therecordhasbeenmodifiedandnotupdatedinthedatabase.

dbRecordNewTherecordhasbeeninsertedwiththeAddNewmethod,butnotyetinsertedintothedatabase.

dbRecordDeleted Therecordhasbeendeleted,butnotyetdeletedinthedatabase.

dbRecordDBDeleted Therecordhasbeendeletedlocallyandinthedatabase.

Remarks

Page 444: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ThevalueoftheRecordStatuspropertyindicateswhetherandhowthecurrentrecordwillbeinvolvedinthenextoptimisticbatchupdate.

Whenauserchangesarecord,theRecordStatusforthatrecordautomaticallychangestodbRecordModified.Similarly,ifarecordisaddedordeleted,RecordStatusreflectstheappropriateconstant.Whenyouthenuseabatch-modeUpdatemethod,DAOwillsubmitanappropriateoperationtotheremoteserverforeachrecord,basedontherecord'sRecordStatusproperty.

Page 445: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ReplicableProperty

Setsorreturnsavaluethatdetermineswhetheradatabaseorobjectinadatabasecanbereplicated(MicrosoftJetworkspacesonly).

NoteBeforegettingorsettingtheReplicablepropertyonaDatabase,TableDef,orQueryDefobject,youmustcreateitbyusingtheCreatePropertymethodandappendittothePropertiescollectionfortheobject.

SettingandReturnValues

ThesettingorreturnvalueisaTextdatatype.

OnaDatabaseobject,settingthispropertyto"T"makesthedatabasereplicable.Onceyousetthepropertyto"T",youcan'tchangeit;settingthepropertyto"F"(oranyvalueotherthan"T")causesanerror.

Onanobjectinadatabase,settingthispropertyto"T"replicatestheobject(andsubsequentchangestotheobject)atallreplicasinthereplicaset.Youcanalsosetthispropertyintheobject'spropertysheetinMicrosoftAccess.

Page 446: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteMicrosoftJet3.5alsosupportstheBooleanReplicableBoolproperty.ItsfunctionalityisidenticaltotheReplicableproperty,exceptthatittakesaBooleanvalue.SettingReplicableBooltoTruemakestheobjectreplicable.

Remarks

BeforesettingtheReplicablepropertyonadatabase,makeabackupcopyofthedatabase.IfsettingtheReplicablepropertyfails,youshoulddeletethepartiallyreplicateddatabase,makeanewcopyfromthebackup,andtryagain.

WhenyousetthispropertyonaDatabaseobject,MicrosoftJetaddsfields,tables,andpropertiestoobjectswithinthedatabase.MicrosoftJetusesthesefields,tables,andpropertiestosynchronizedatabaseobjects.Forexample,allexistingtableshavethreenewfieldsaddedtothemthathelpidentifywhichrecordshavechanged.Theadditionofthesefieldsandotherobjectsincreasethesizeofyourdatabase.

Onforms,reports,macros,andmodulesdefinedbyahostapplication(suchasMicrosoftAccess),yousetthispropertyonthehost-definedobjectthroughthehostuserinterface.Onceset,theReplicablepropertywillappearinthePropertiescollectionfortheDocumentobjectrepresentingthehostobject.

IftheReplicablepropertyhasalreadybeensetonanobjectusingtheReplicatedcheckboxinthepropertysheetfortheobject,youcannotsettheReplicablepropertyincode.

Whenyoucreateanewtable,query,form,report,macro,ormoduleatareplica,theobjectisconsideredlocalandisstoredonlyatthatreplica.Ifyouwantusersatotherreplicastobeabletousetheobject,youmustchangeitfromlocaltoreplicable.EithercreatetheobjectatorimportitintotheDesignMasterandthensettheReplicablepropertyto"T".

TheobjectonwhichyouaresettingtheReplicablepropertymighthavealreadyinheritedthatpropertyfromanotherobject.However,thevaluesetbytheotherobjecthasnoeffectonthebehavioroftheobjectyou

Page 447: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

wanttomakereplicable.Youmustexplicitlysetthepropertyforeachobject.

Page 448: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ReplicaFilterProperty

SetsorreturnsavalueonaTableDefobjectwithinapartialreplicathatindicateswhichsubsetofrecordsisreplicatedtothattablefromafullreplica.(MicrosoftJetdatabasesonly.)

SettingsAndReturnValues

ThesettingorreturnvalueisaStringorBooleanthatindicateswhichsubsetofrecordsisreplicated,asspecifiedinthefollowingtable:

Value Description

Astring Acriteriathatarecordinthepartialreplicatablemustsatisfyinordertobereplicatedfromthefullreplica.

True Replicatesallrecords.False (Default)Doesn'treplicateanyrecords.

Remarks

ThispropertyissimilartoanSQLWHEREclause(withoutthewordWHERE),butyoucannotspecifysubqueries,aggregatefunctions(suchasCount),oruser-definedfunctionswithinthecriteria.

Page 449: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Youcanonlysynchronizedatabetweenafullreplicaandapartialreplica.Youcan'tsynchronizedatabetweentwopartialreplicas.Also,withpartialreplicationyoucansetrestrictionsonwhichrecordsarereplicated,butyoucan'tindicatewhichfieldsarereplicated.

Usually,youresetareplicafilterwhenyouwanttoreplicateadifferentsetofrecords.Forexample,whenasalesrepresentativetemporarilytakesoveranothersalesrepresentative'sregion,thedatabaseapplicationcantemporarilyreplicatedataforbothregionsandthenreturntothepreviousfilter.Inthisscenario,theapplicationresetstheReplicaFilterpropertyandthenrepopulatesthepartialreplica.

Ifyourapplicationchangesreplicafilters,youshouldfollowthesesteps:

1. UsetheSynchronizemethodtosynchronizeyourfullreplicawiththepartialreplicainwhichthefiltersarebeingchanged.

2. UsetheReplicaFilterpropertytomakethedesiredchangestothereplicafilter.

3. UsethePopulatePartialmethodtoremoveallrecordsfromthepartialreplicaandtransferallrecordsfromthefullreplicathatmeetthenewreplicafiltercriteria.

Toremoveafilter,settheReplicaFilterpropertytoFalse.IfyouremoveallfiltersandinvokethePopulatePartialmethod,norecordswillappearinanyreplicatedtablesinthepartialreplica.

NoteIfareplicafilterhaschanged,andtheSynchronizemethodisinvokedwithoutfirstinvokingPopulatePartial,atrappableerroroccurs.

Page 450: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ReplicaIDProperty

Returnsa16-bytevaluethatuniquelyidentifiesadatabasereplica(MicrosoftJetworkspacesonly).

ReturnValues

ThereturnvalueisaGUIDvaluethatuniquelyidentifiesthereplicaorDesignMaster.

Remarks

TheMicrosoftJetdatabaseengineautomaticallygeneratesthisvaluewhenyoucreateanewreplica.

TheReplicaIDpropertyofeachreplica(andtheDesignMaster)isstoredintheMSysReplicassystemtable.

Page 451: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RequiredProperty

SetsorreturnsavaluethatindicateswhetheraFieldobjectrequiresanon-NullvalueorwhetherallthefieldsinanIndexobjectmusthaveavalue.

SettingsandReturnValues

ThesettingorreturnvalueisaBooleanthatisTrueifafieldcan'tcontainaNullvalue.

Foranobjectnotyetappendedtoacollection,thispropertyisread/write.ForanIndexobject,thispropertysettingisread-onlyforobjectsappendedtoIndexescollectionsinRecordsetandTableDefobjects.

Remarks

TheavailabilityoftheRequiredpropertydependsontheobjectthatcontainstheFieldscollection,asshowninthefollowingtable.

IftheFieldscollectionbelongstoa ThenRequiredis

Indexobject Notsupported

Page 452: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

QueryDefobject Read-onlyRecordsetobject Read-onlyRelationobject NotsupportedTableDefobject Read/write

ForaFieldobject,youcanusetheRequiredpropertyalongwiththeAllowZeroLength,ValidateOnSet,orValidationRulepropertytodeterminethevalidityoftheValuepropertysettingforthatFieldobject.IftheRequiredpropertyissettoFalse,thefieldcancontainNullvaluesaswellasvaluesthatmeettheconditionsspecifiedbytheAllowZeroLengthandValidationRulepropertysettings.

NoteWhenyoucansetthispropertyforeitheranIndexobjectoraFieldobject,setitfortheFieldobject.ThevalidityofthepropertysettingforaFieldobjectischeckedbeforethatofanIndexobject.

Page 453: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

RestartableProperty

ReturnsavaluethatindicateswhetheraRecordsetobjectsupportstheRequerymethod,whichre-executesthequeryonwhichtheRecordsetobjectisbased.

ReturnValues

ThereturnvalueisaBooleandatatypethatisTrueiftheRecordsetobjectsupportstheRequerymethod.Table-typeRecordsetobjectsalwaysreturnFalse.

Remarks

ChecktheRestartablepropertybeforeusingtheRequerymethodonaRecordsetobject.Iftheobject'sRestartablepropertyissettoFalse,usetheOpenRecordsetmethodontheunderlyingQueryDefobjecttore-executethequery.

Page 454: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ReturnsRecordsProperty

SetsorreturnsavaluethatindicateswhetheranSQLpass-throughquerytoanexternaldatabasereturnsrecords(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaBooleanthatisTrue(default)ifapass-throughqueryreturnsrecords.

Remarks

NotallSQLpass-throughqueriestoexternaldatabasesreturnrecords.Forexample,anSQLUPDATEstatementupdatesrecordswithoutreturningrecords,whileanSQLSELECTstatementdoesreturnrecords.Ifthequeryreturnsrecords,settheReturnsRecordspropertytoTrue;ifthequerydoesn'treturnrecords,settheReturnsRecordspropertytoFalse.

NoteYoumustsettheConnectpropertybeforeyousettheReturnsRecordsproperty.

Page 455: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SizeProperty

Setsorreturnsavaluethatindicatesthemaximumsize,inbytes,ofaFieldobject.

SettingsandReturnValues

ThesettingorreturnvalueisaconstantthatindicatesthemaximumsizeofaFieldobject.ForanobjectnotyetappendedtotheFieldscollection,thispropertyisread/write.ThesettingdependsontheTypepropertysettingoftheFieldobject,asdiscussedunderRemarks.

Remarks

Forfields(otherthanMemotypefields)thatcontaincharacterdata,theSizepropertyindicatesthemaximumnumberofcharactersthatthefieldcanhold.Fornumericfields,theSizepropertyindicateshowmanybytesofstoragearerequired.

UseoftheSizepropertydependsontheobjectthatcontainstheFieldscollectiontowhichtheFieldobjectisappended,asshowninthefollowingtable.

Page 456: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ObjectappendedtoUsageIndex NotsupportedQueryDef Read-onlyRecordset Read-onlyRelation NotsupportedTableDef Read-only

WhenyoucreateaFieldobjectwithadatatypeotherthanText,theTypepropertysettingautomaticallydeterminestheSizepropertysetting;youdon'tneedtosetit.ForaFieldobjectwiththeTextdatatype,however,youcansetSizetoanyintegeruptothemaximumtextsize(255forMicrosoftJetdatabases).Ifyoudonotsetthesize,thefieldwillbeaslargeasthedatabaseallows.

ForLongBinaryandMemoFieldobjects,Sizeisalwayssetto0.UsetheFieldSizepropertyoftheFieldobjecttodeterminethesizeofthedatainaspecificrecord.ThemaximumsizeofaLongBinaryorMemofieldislimitedonlybyyoursystemresourcesorthemaximumsizethatthedatabaseallows.

Page 457: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SortProperty

SetsorreturnsthesortorderforrecordsinaRecordsetobject(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringthatcontainstheORDERBYclauseofanSQLstatementwithoutthereservedwordsORDERBY.

Remarks

YoucanusetheSortpropertywithdynaset-andsnapshot-typeRecordsetobjects.

Whenyousetthispropertyforanobject,sortingoccurswhenasubsequentRecordsetobjectiscreatedfromthatobject.TheSortpropertysettingoverridesanysortorderspecifiedforaQueryDefobject.

Thedefaultsortorderisascending(AtoZor0to100).

TheSortpropertydoesn'tapplytotable-orforward-only–typeRecordsetobjects.Tosortatable-typeRecordsetobject,usetheIndex

Page 458: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

property.

NoteInmanycases,it'sfastertoopenanewRecordsetobjectbyusinganSQLstatementthatincludesthesortingcriteria.

Page 459: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SourceProperty

Returnsthenameoftheobjectorapplicationthatoriginallygeneratedtheerror.

ReturnValues

ThereturnvalueisaStringrepresentingtheobjectorapplicationthatgeneratedtheerror.

Remarks

TheSourcepropertyvalueisusuallytheobject'sclassnameorprogrammaticID.UsetheSourcepropertytoprovideyouruserswithinformationwhenyourcodeisunabletohandleanerrorgeneratedinanobjectinanotherapplication.

Forexample,ifyouaccessMicrosoftExcelanditgeneratesa"Divisionbyzero"error,MicrosoftExcelsetsError.NumbertotheMicrosoftExcelcodeforthaterrorandsetstheSourcepropertytoExcel.Application.NotethatiftheerrorisgeneratedinanotherobjectcalledbyMicrosoftExcel,MicrosoftExcelinterceptstheerrorandstillsetsError.NumbertotheMicrosoftExcelcode.However,theother

Page 460: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Errorobjectproperties(includingSource)willretainthevaluesassetbytheobjectthatgeneratedtheerror.TheSourcepropertyalwayscontainsthenameoftheobjectthatoriginallygeneratedtheerror.

Basedonalloftheerrordocumentation,youcanwritecodethatwillhandletheerrorappropriately.Ifyourerrorhandlerfails,youcanusetheErrorobjectinformationtodescribetheerrortoyouruser,usingtheSourcepropertyandtheotherErrorpropertiestogivetheuserinformationaboutwhichobjectoriginallycausedtheerror,thedescriptionoftheerror,andsoforth.

NoteTheOnErrorResumeNextconstructmaybepreferabletoOnErrorGoTowhendealingwitherrorsgeneratedduringaccesstootherobjects.CheckingtheErrorobjectpropertyaftereachinteractionwithanobjectremovesambiguityaboutwhichobjectyourcodewasaccessingwhentheerroroccurred.Thus,youcanbesurewhichobjectplacedtheerrorcodeinError.Number,aswellaswhichobjectoriginallygeneratedtheerror(Error.Source).

Page 461: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SourceField,SourceTableProperties

SourceField—returnsavaluethatindicatesthenameofthefieldthatistheoriginalsourceofthedataforaFieldobject.

SourceTable—returnsavaluethatindicatesthenameofthetablethatistheoriginalsourceofthedataforaFieldobject.

ReturnValues

ThereturnvalueisaStringspecifyingthenameofthefieldortablethatisthesourceofdata.

Remarks

ForaFieldobject,useoftheSourceFieldandSourceTablepropertiesdependsontheobjectthatcontainstheFieldscollectionthattheFieldobjectisappendedto,asshowninthefollowingtable.

ObjectappendedtoUsageIndex NotsupportedQueryDef Read-only

Page 462: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Recordset Read-onlyRelation NotsupportedTableDef Read-only

ThesepropertiesindicatetheoriginalfieldandtablenamesassociatedwithaFieldobject.Forexample,youcouldusethesepropertiestodeterminetheoriginalsourceofthedatainaqueryfieldwhosenameisunrelatedtothenameofthefieldintheunderlyingtable.

NoteTheSourceTablepropertywillnotreturnameaningfultablenameifusedonaFieldobjectintheFieldscollectionofatable-typeRecordsetobject.

Page 463: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SourceTableNameProperty

Setsorreturnsavaluethatspecifiesthenameofalinkedtableorthenameofabasetable(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringthatspecifiesatablename.Forabasetable,thesettingisazero-lengthstring("").Thispropertysettingisread-onlyforabasetableandread/writeforalinkedtableoranobjectnotappendedtoacollection.

Page 464: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SQLProperty

SetsorreturnstheSQLstatementthatdefinesthequeryexecutedbyaQueryDefobject.

SettingsandReturnValues

ThesettingorreturnvalueisaStringthatcontainsanSQLstatement.

Remarks

TheSQLpropertycontainstheSQLstatementthatdetermineshowrecordsareselected,grouped,andorderedwhenyouexecutethequery.YoucanusethequerytoselectrecordstoincludeinaRecordsetobject.Youcanalsodefineactionqueriestomodifydatawithoutreturningrecords.

TheSQLsyntaxusedinaquerymustconformtotheSQLdialectofthequeryengine,whichisdeterminedbythetypeofworkspace.InaMicrosoftJetworkspace,usetheMicrosoftJetSQLdialect,unlessyoucreateanSQLpass-throughquery,inwhichcaseyoushouldusethedialectoftheserver.InanODBCDirectworkspace,usetheSQLdialectoftheserver.

Page 465: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteYoucansendDAOqueriestoavarietyofdifferentdatabaseserverswithODBCDirect,anddifferentserverswillrecognizeslightlydifferentdialectsofSQL.Therefore,context-sensitiveHelpisnolongerprovidedforMicrosoftJetSQL,althoughonlineHelpforMicrosoftJetSQLisstillincludedthroughtheHelpmenu.BesuretochecktheappropriatereferencedocumentationfortheSQLdialectofyourdatabaseserverwhenusingeitherODBCDirectconnectionsorpass-throughqueriesinMicrosoftJet-connectedclient/serverapplications.

IftheSQLstatementincludesparametersforthequery,youmustsetthesebeforeexecution.Untilyouresettheparameters,thesameparametervaluesareappliedeachtimeyouexecutethequery.

InanODBCDirectworkspace,youcanalsousetheSQLpropertytoexecuteapreparedstatementontheserver.Forexample,settingtheSQLpropertytothefollowingstringwillexecuteapreparedstatementnamed“GetData”withoneparameteronaMicrosoftSQLServerback-end.

"{callGetData(?)}"

InaMicrosoftJetworkspace,usingaQueryDefobjectisthepreferredwaytoperformSQLpass-throughoperationsonMicrosoftJet-connectedODBCdatasources.BysettingtheQueryDefobject'sConnectpropertytoanODBCdatasource,youcanusenon–Microsoft-Jet-databaseSQLinthequerytobepassedtotheexternalserver.Forexample,youcanuseTRANSACTSQLstatements(withMicrosoftSQLServerorSybaseSQLServerdatabases),whichtheMicrosoftJetdatabaseenginewouldotherwisenotprocess.

NoteIfyousetthepropertytoastringconcatenatedwithanon-integervalue,andthesystemparametersspecifyanon-U.S.decimalcharactersuchasacomma(forexample,strSQL="PRICE>"&lngPrice,andlngPrice=125,50),anerrorwillresultwhenyoutrytoexecutetheQueryDefobjectinaMicrosoftJetdatabase.Thisisbecauseduringconcatenation,thenumberwillbeconvertedtoastringusingyoursystem'sdefaultdecimalcharacter,andMicrosoft

Page 466: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

JetSQLonlyacceptsU.S.decimalcharacters.

Page 467: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

StillExecutingProperty

Indicateswhetherornotanasynchronousoperation(thatis,amethodcalledwiththedbRunAsyncoption)hasfinishedexecuting(ODBCDirectworkspacesonly).

SettingsAndReturnValues

ThereturnvalueisaBooleanthatisTrueifthequeryisstillexecuting,andFalseifthequeryhascompleted.

Remarks

UsetheStillExecutingpropertytodetermineifthemostrecentlycalledasynchronousExecute,MoveLast,OpenConnection,orOpenRecordsetmethod(thatis,amethodexecutedwiththedbRunAsyncoption)iscomplete.WhiletheStillExecutingpropertyisTrue,anyreturnedobjectcannotbeaccessed.

ThefollowingtableshowswhatmethodisevaluatedwhenyouuseStillExecutingonaparticulartypeofobject.

IfStillExecutingisusedon Thisasynchronousmethodisevaluated

Page 468: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Connection ExecuteorOpenConnectionQueryDef ExecuteRecordset MoveLastorOpenRecordset

OncetheStillExecutingpropertyonaConnectionorRecordsetobjectreturnsFalse,follwingtheOpenConnectionorOpenRecordsetcallthatreturnstheassociatedRecordsetorConnectionobject,theobjectcanbereferenced.SolongasStillExecutingremainsTrue,theobjectmaynotbereferenced,otherthantoreadtheStillExecutingproperty.WhenyouusetheNextRecordsetmethodtocompleteprocessingofaRecordset,theStillExecutingpropertyisresettoTruewhilesubsequentresultsetsareretrieved.

UsetheCancelmethodtoterminateexecutionofataskinprogress.

Page 469: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SystemDBProperty

Setsorreturnsthepathforthecurrentlocationoftheworkgroupinformationfile(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringdescribingthefullyresolvedpathtotheworkgroupinformationfile.

Remarks

TheMicrosoftJetdatabaseengineallowsyoutodefineaworkgroupandsetdifferentaccesspermissionstoeachobjectinthedatabaseforeachuserintheworkgroup.Theworkgroupisdefinedbytheworkgroupinformationfile,typicallycalled"system.mdw".Foruserstogainaccesstothesecuredobjectsinyourdatabase,DAOmusthavethelocationofthisworkgroupinformationfile.ThelocationcanbeidentifiedtoDAOeitherbyspecifyingitintheWindowsRegistryorbysettingtheSystemDBproperty.Onsetup,thedefaultsettingissimply"system.mdw"withnopath.

Forthisoptiontohaveanyeffect,youmustsettheSystemDBproperty

Page 470: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

beforeyourapplicationinitializestheDBEngineobject(thatis,beforecreatinganinstanceofanyotherDAOobject).Thescopeofthissettingislimitedtoyourapplicationandcan'tbechangedwithoutrestartingyourapplication.

Page 471: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TableProperty

IndicatesthenameofaRelationobject'sprimarytable.ThisshouldbeequaltotheNamepropertysettingofaTableDeforQueryDefobject(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringthatevaluatestothenameofatableintheTableDefscollectionorqueryintheQueryDefscollection.TheTablepropertysettingisread/writeforanewRelationobjectnotyetappendedtoacollectionandread-onlyforanexistingRelationobjectinaRelationscollection.

Remarks

UsetheTablepropertywiththeForeignTablepropertytodefineaRelationobject,whichrepresentstherelationshipbetweenfieldsintwotablesorqueries.SettheTablepropertytotheNamepropertysettingoftheprimaryTableDeforQueryDefobject,andsettheForeignTablepropertytotheNamepropertysettingoftheforeign(referencing)TableDeforQueryDefobject.TheAttributespropertydeterminesthetypeofrelationshipbetweenthetwoobjects.

Page 472: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Forexample,ifyouhadalistofvalidpartcodes(inafieldnamedPartNo)storedinaValidPartstable,youcouldestablishaone-to-manyrelationshipwithanOrderItemtablesuchthatifapartcodewereenteredintotheOrderItemtable,itwouldhavetoalreadybeintheValidPartstable.Ifthepartcodedidn'texistintheValidPartstableandyouhadnotsettheAttributespropertyoftheRelationobjecttodbRelationDontEnforce,atrappableerrorwouldoccur.

Inthiscase,theValidPartstableistheprimarytable,sotheTablepropertyoftheRelationobjectwouldbesettoValidPartsandtheForeignTablepropertyoftheRelationobjectwouldbesettoOrderItem.TheNameandForeignNamepropertiesoftheFieldobjectintheRelationobject'sFieldscollectionwouldbesettoPartNo.

Thefollowingillustrationdepictsthisrelation.

Page 473: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TransactionsProperty

Returnsavaluethatindicateswhetheranobjectsupportstransactions.

ReturnValues

ThereturnvalueisaBooleandatatypethatisTrueiftheobjectsupportstransactions.

Remarks

InanODBCDirectworkspace,theTransactionspropertyisavailableonConnectionandDatabaseobjects,andindicateswhetherornottheODBCdriveryouareusingsupportstransactions.

InaMicrosoftJetworkspace,youcanalsousetheTransactionspropertywithdynaset-ortable-typeRecordsetobjects.Snapshot-andforward-only–typeRecordsetobjectsalwaysreturnFalse.

Ifadynaset-ortable-typeRecordsetisbasedonaMicrosoftJetdatabaseenginetable,theTransactionspropertyisTrueandyoucanusetransactions.Otherdatabaseenginesmaynotsupporttransactions.Forexample,youcan'tusetransactionsinadynaset-typeRecordset

Page 474: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

objectbasedonaParadoxtable.

ChecktheTransactionspropertybeforeusingtheBeginTransmethodontheRecordsetobject'sWorkspaceobjecttomakesurethattransactionsaresupported.UsingtheBeginTrans,CommitTrans,orRollbackmethodsonanunsupportedobjecthasnoeffect.

Page 475: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TypeProperty

Setsorreturnsavaluethatindicatestheoperationaltypeordatatypeofanobject.

SettingsandReturnValues

Thesettingorreturnvalueisaconstantthatindicatesanoperationalordatatype.ForaFieldorPropertyobject,thispropertyisread/writeuntiltheobjectisappendedtoacollectionortoanotherobject,afterwhichit'sread-only.ForaQueryDef,Recordset,orWorkspaceobject,thepropertysettingisread-only.ForaParameterobjectinaMicrosoftJetworkspacethepropertyisread-only,whileinanODBCDirectworkspacethepropertyisalwaysread-write.

ForaField,Parameter,orPropertyobject,thepossiblesettingsandreturnvaluesaredescribedinthefollowingtable.

Constant DescriptiondbBigInt BigIntegerdbBinary BinarydbBoolean BooleandbByte Byte

Page 476: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbChar ChardbCurrency CurrencydbDate Date/TimedbDecimal DecimaldbDouble DoubledbFloat FloatdbGUID GUIDdbInteger IntegerdbLong LongdbLongBinary LongBinary(OLEObject)dbMemo MemodbNumeric NumericdbSingle SingledbText TextdbTime TimedbTimeStamp TimeStampdbVarBinary VarBinary

ForaQueryDefobject,thepossiblesettingsandreturnvaluesareshowninthefollowingtable.

Constant QuerytypedbQAction ActiondbQAppend AppenddbQCompound [email protected] CrosstabdbQDDL Data-definitiondbQDelete DeletedbQMakeTable Make-tabledbQProcedure Procedure(ODBCDirectworkspacesonly)dbQSelect SelectdbQSetOperation Union

dbQSPTBulk UsedwithdbQSQLPassThroughtospecifyaquerythatdoesn'treturnrecords(MicrosoftJetworkspacesonly).

dbQSQLPassThrough Pass-through(MicrosoftJetworkspacesonly)dbQUpdate Update

Page 477: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

NoteTocreateanSQLpass-throughqueryinaMicrosoftJetworkspace,youdon'tneedtoexplicitlysettheTypepropertytodbQSQLPassThrough.TheMicrosoftJetdatabaseengineautomaticallysetsthiswhenyoucreateaQueryDefobjectandsettheConnectproperty.

ForaRecordsetobject,thepossiblesettingsandreturnvaluesareasfollows.

Constant RecordsettypedbOpenTable Table(MicrosoftJetworkspacesonly)dbOpenDynamic Dynamic(ODBCDirectworkspacesonly)dbOpenDynaset DynasetdbOpenSnapshot SnapshotdbOpenForwardOnlyForward-only

ForaWorkspaceobject,thepossiblesettingsandreturnvaluesareasfollows.

Constant Workspacetype

dbUseJet TheWorkspaceisconnectedtotheMicrosoftJetdatabaseengine.

dbUseODBC TheWorkspaceisconnectedtoanODBCdatasource.

Remarks

WhenyouappendanewField,Parameter,orPropertyobjecttothecollectionofanIndex,QueryDef,Recordset,orTableDefobject,anerroroccursiftheunderlyingdatabasedoesn'tsupportthedatatypespecifiedforthenewobject.

Page 478: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UniqueProperty

SetsorreturnsavaluethatindicateswhetheranIndexobjectrepresentsaunique(key)indexforatable(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaBooleanthatisTrueiftheIndexobjectrepresentsauniqueindex.ForanIndexobject,thispropertysettingisread/writeuntiltheobjectisappendedtoacollection,afterwhichit'sread-only.

Remarks

Auniqueindexconsistsofoneormorefieldsthatlogicallyarrangeallrecordsinatableinaunique,predefinedorder.Iftheindexconsistsofonefield,valuesinthatfieldmustbeuniquefortheentiretable.Iftheindexconsistsofmorethanonefield,eachfieldcancontainduplicatevalues,buteachcombinationofvaluesfromalltheindexedfieldsmustbeunique.

IfboththeUniqueandPrimarypropertiesofanIndexobjectaresettoTrue,theindexisuniqueandprimary:Ituniquelyidentifiesallrecordsin

Page 479: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

thetableinapredefined,logicalorder.IfthePrimarypropertyissettoFalse,theindexisasecondaryindex.Secondaryindexes(bothkeyandnonkey)logicallyarrangerecordsinapredefinedorderwithoutservingasanidentifierforrecordsinthetable.

Notes

Youdon'thavetocreateindexesfortables,butinlarge,unindexedtables,accessingaspecificrecordcantakealongtime.

Recordsretrievedfromtableswithoutindexesarereturnedinnoparticularsequence.

TheAttributespropertyofeachFieldobjectintheIndexobjectdeterminestheorderofrecordsandconsequentlydeterminestheaccesstechniquestouseforthatIndexobject.

Auniqueindexhelpsoptimizefindingrecords.

Indexesdon'taffectthephysicalorderofabasetable?indexesaffectonlyhowtherecordsareaccessedbythetable-typeRecordsetobjectwhenaparticularindexischosenorwhentheMicrosoftJetdatabaseenginecreatesRecordsetobjects.

Page 480: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UpdatableProperty

ReturnsavaluethatindicateswhetheryoucanchangeaDAOobject.

ReturnValues

ThereturnvalueisaBooleandatatypethatisTrueiftheobjectcanbechangedorupdated.(Snapshot-andforward-only–typeRecordsetobjectsalwaysreturnFalse.)

Remarks

Dependingontheobject,iftheUpdatablepropertysettingisTrue,theassociatedstatementinthefollowingtableistrue.

Object TypeindicatesConnection Dataintheconnecteddatabasecanbechanged.Database TheobjectcanbechangedQueryDef ThequerydefinitioncanbechangedRecordset TherecordscanbeupdatedTableDef Thetabledefinitioncanbechanged

TheUpdatablepropertysettingisalwaysTrueforanewlycreated

Page 481: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TableDefobjectandFalseforalinkedTableDefobject.AnewTableDefobjectcanbeappendedonlytoadatabaseforwhichthecurrentuserhaswritepermission.

Manytypesofobjectscancontainfieldsthatcan'tbeupdated.Forexample,youcancreateadynaset-typeRecordsetobjectinwhichonlysomefieldscanbechanged.Thesefieldscanbefixedorcontaindatathatincrementsautomatically,orthedynasetcanresultfromaquerythatcombinesupdatableandnonupdatabletables.

Iftheobjectcontainsonlyread-onlyfields,thevalueoftheUpdatablepropertyisFalse.Whenoneormorefieldsareupdatable,theproperty'svalueisTrue.Youcaneditonlytheupdatablefields.Atrappableerroroccursifyoutrytoassignanewvaluetoaread-onlyfield.

TheUpdatablepropertyofaQueryDefobjectissettoTrueifthequerydefinitioncanbeupdated,eveniftheresultingRecordsetobjectisn'tupdatable.

Becauseanupdatableobjectcancontainread-onlyfields,checktheDataUpdatablepropertyofeachfieldintheFieldscollectionofaRecordsetobjectbeforeyoueditarecord.

Page 482: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UpdateOptionsProperty

SetsorreturnsavaluethatindicateshowtheWHEREclauseisconstructedforeachrecordduringabatchupdate,andwhetherthebatchupdateshoulduseanUPDATEstatementoraDELETEfollowedbyanINSERT(ODBCDirectworkspacesonly).

SettingsAndReturnValues

ThesettingorreturnvalueisaLongthatcanbeanyofthefollowingconstants:

Constant Description

dbCriteriaKey (Default)Usesjustthekeycolumn(s)inthewhereclause.

dbCriteriaModValues Usesthekeycolumn(s)andallupdatedcolumnsinthewhereclause.

dbCriteriaAllCols Usesthekeycolumn(s)andallthecolumnsinthewhereclause.

dbCriteriaTimeStampUsesjustthetimestampcolumnifavailable(willgeneratearun-timeerrorifnotimestampcolumnisintheresultset).

dbCriteriaDeleteInsert UsesasetofDELETEandINSERTstatementsforeachmodifiedrow.

Page 483: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dbCriteriaUpdate (Default)UsesanUPDATEstatementforeachmodifiedrow.

Remarks

Whenabatch-modeUpdateisexecuted,DAOandtheclientbatchcursorlibrarycreateaseriesofSQLUPDATEstatementstomaketheneededchanges.AnSQLWHEREclauseiscreatedforeachupdatetoisolatetherecordsthataremarkedaschangedbytheRecordStatusproperty.Becausesomeremoteserversusetriggersorotherwaystoenforcereferentialintegrity,isitoftenimportanttolimitthefieldsbeingupdatedtojustthoseaffectedbythechange.Todothis,settheUpdateOptionspropertytooneoftheconstantsdbCriteriaKey,dbCriteriaModValues,dbCriteriaAllCols,ordbCriteriaTimeStamp.Thisway,onlytheabsoluteminimumamountoftriggercodeisexecuted.Asaresult,theupdateoperationisexecutedmorequickly,andwithfewerpotentialerrors.

YoucanalsoconcatenateeitheroftheconstantsdbCriteriaDeleteInsertordbCriteriaUpdatetodeterminewhethertouseasetofSQLDELETEandINSERTstatementsoranSQLUPDATEstatementforeachupdatewhensendingbatchedmodificationsbacktotheserver.Intheformercase,twoseparateoperationsarerequiredtoupdatetherecord.Insomecases,especiallywheretheremotesystemimplementsDELETE,INSERT,andUPDATEtriggers,choosingthecorrectUpdateOptionspropertysettingcansignificantlyimpactperformance.

Ifyoudon'tspecifyanyconstants,dbCriteriaUpdateanddbCriteriaKeywillbeused.

NewlyaddedrecordswillalwaysgenerateINSERTstatementsanddeletedrecordswillalwaysgenerateDELETEstatements,sothispropertyonlyappliestohowthecursorlibraryupdatesmodifiedrecords.

Page 484: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

UserNameProperty

Setsorreturnsavaluethatrepresentsauser,agroupofusers,ortheownerofaWorkspaceobject.

SettingsandReturnValues

ThesettingorreturnvalueisaStringthatevaluatestothenameofauser.InaMicrosoftJetworkspace,thisrepresentsaUserobjectintheUserscollectionoraGroupobjectintheGroupscollection.ForMicrosoftJetContainerandDocumentobjects,thispropertysettingisread/write.ForallWorkspaceobjects,thispropertysettingisread-only.

Remarks

Dependingonthetypeofobject,theUserNamepropertyrepresentsthefollowing.

TheownerofaWorkspaceobject.

AuserorgroupofuserswhenyoumanipulatetheaccesspermissionsofaContainerobjectoraDocumentobject

Page 485: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

(MicrosoftJetworkspacesonly).

Tofindorsetthepermissionsforaparticularuserorgroupofusers,firstsettheUserNamepropertytotheuserorgroupnamethatyouwanttoexamine.ThencheckthePermissionspropertysettingtodeterminewhatpermissionsthatuserorgroupofusershas,orsetthePermissionspropertytochangethepermissions.

ForaWorkspaceobject,checktheUserNamepropertysettingtodeterminetheowneroftheWorkspaceobject.SettheUserNamepropertytoestablishtheowneroftheWorkspaceobjectbeforeyouappendtheobjecttotheWorkspacescollection.

Page 486: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

V1xNullBehaviorProperty

Indicateswhetherzero-lengthstrings("")usedincodetofillTextorMemofieldsareconvertedtoNull.

SettingsandReturnValues

ThesettingorreturnvalueisaBooleanthatisTrueifzero-lengthstringsareconvertedtoNull.

Remarks

ThispropertyappliestoMicrosoftJetdatabaseengineversion1.xdatabasesthathavebeenconvertedtoMicrosoftJetdatabaseengineversion2.0or3.0databases.

NoteTheMicrosoftJetdatabaseengineautomaticallycreatesthispropertywhenitconvertsaversion1.xdatabasetoaversion2.0or3.xdatabase.A2.0databasewillretainthispropertywhenitisconvertedtoa3.xdatabase.

Ifyouchangethispropertysetting,youmustcloseandthenreopenthedatabaseforyourchangetotakeeffect.

Page 487: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Forfastestperformance,modifycodethatsetsanyTextorMemofieldstozero-lengthstringssothatthefieldsaresettoNullinstead,andremovetheV1xNullBehaviorpropertyfromthePropertiescollection.

Page 488: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ValidateOnSetProperty

SetsorreturnsavaluethatspecifieswhetherornotthevalueofaFieldobjectisimmediatelyvalidatedwhentheobject'sValuepropertyisset(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaBooleanthatcanbeoneofthefollowingvalues.

Value Description

TrueThevalidationrulespecifiedbytheValidationRulepropertysettingoftheFieldobjectischeckedwhenyousettheobject'sValueproperty.

False (Default)Validatewhentherecordisupdated.

OnlyFieldobjectsinRecordsetobjectssupporttheValidateOnSetpropertyasread/write.

Remarks

SettingtheValidateOnSetpropertytoTruecanbeusefulinasituationwhenauserisenteringrecordsthatincludesubstantialMemodata.

Page 489: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

WaitinguntiltheUpdatecalltovalidatethedatacanresultinunnecessarytimespentwritingthelengthyMemodatatothedatabaseifitturnsoutthatthedatawasinvalidanywaybecauseavalidationrulewasbrokeninanotherfield.

Page 490: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ValidationRuleProperty

Setsorreturnsavaluethatvalidatesthedatainafieldasit'schangedoraddedtoatable(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingsorreturnvaluesisaStringthatdescribesacomparisonintheformofanSQLWHEREclausewithouttheWHEREreservedword.ForanobjectnotyetappendedtotheFieldscollection,thispropertyisread/write.SeeRemarksforthemorespecificread/writecharacteristicsofthisproperty.

Remarks

TheValidationRulepropertydetermineswhetherornotafieldcontainsvaliddata.Ifthedataisnotvalid,atrappablerun-timeerroroccurs.ThereturnederrormessageisthetextoftheValidationTextproperty,ifspecified,orthetextoftheexpressionspecifiedbyValidationRule.

ForaFieldobject,useoftheValidationRulepropertydependsontheobjectthatcontainstheFieldscollectiontowhichtheFieldobjectisappended.

Page 491: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ObjectappendedtoUsageIndex NotsupportedQueryDef Read-onlyRecordset Read-onlyRelation NotsupportedTableDef Read/write

ForaRecordsetobject,useoftheValidationRulepropertyisread-only.ForaTableDefobject,useoftheValidationRulepropertydependsonthestatusoftheTableDefobject,asthefollowingtableshows.

TableDef UsageBasetable Read/writeLinkedtableRead-only

ValidationissupportedonlyfordatabasesthatusetheMicrosoftJetdatabaseengine.

ThestringexpressionspecifiedbytheValidationRulepropertyofaFieldobjectcanreferonlytothatField.Theexpressioncan'trefertouser-definedfunctions,SQLaggregatefunctions,orqueries.TosetaFieldobject'sValidationRulepropertywhenitsValidateOnSetpropertysettingisTrue,theexpressionmustsuccessfullyparse(withthefieldnameasanimpliedoperand)andevaluatetoTrue.IfitsValidateOnSetpropertysettingisFalse,theValidationRulepropertysettingisignored.

TheValidationRulepropertyofaRecordsetorTableDefobjectcanrefertomultiplefieldsinthatobject.TherestrictionsnotedearlierinthistopicfortheFieldobjectapply.

Foratable-typeRecordsetobject,theValidationRulepropertyinheritstheValidationRulepropertysettingoftheTableDefobjectthatyouusetocreatethetable-typeRecordsetobject.

ForaTableDefobjectbasedonanlinkedtable,theValidationRulepropertyinheritstheValidationRulepropertysettingoftheunderlyingbasetable.Iftheunderlyingbasetabledoesn'tsupportvalidation,the

Page 492: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

valueofthispropertyisazero-lengthstring("").

NoteIfyousetthepropertytoastringconcatenatedwithanon-integervalue,andthesystemparametersspecifyanon-U.S.decimalcharactersuchasacomma(forexample,strRule="PRICE>"&lngPrice,andlngPrice=125,50),anerrorwillresultwhenyourcodeattemptstovalidateanydata.Thisisbecauseduringconcatenation,thenumberwillbeconvertedtoastringusingyoursystem'sdefaultdecimalcharacter,andMicrosoftJetSQLonlyacceptsU.S.decimalcharacters.

Page 493: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ValidationTextProperty

SetsorreturnsavaluethatspecifiesthetextofthemessagethatyourapplicationdisplaysifthevalueofaFieldobjectdoesn'tsatisfythevalidationrulespecifiedbytheValidationRulepropertysetting(MicrosoftJetworkspacesonly).

SettingsandReturnValues

ThesettingorreturnvalueisaStringthatspecifiesthetextdisplayedifausertriestoenteraninvalidvalueforafield.Foranobjectnotyetappendedtoacollection,thispropertyisread/write.ForaRecordsetobject,thispropertysettingisread-only.ForaTableDefobject,thispropertysettingisread-onlyforalinkedtableandread/writeforabasetable.

Remarks

ForaFieldobject,useoftheValidationTextpropertydependsontheobjectthatcontainstheFieldscollectiontowhichtheFieldobjectisappended,asthefollowingtableshows.

ObjectappendedtoUsage

Page 494: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Index NotsupportedQueryDef Read-onlyRecordset Read-onlyRelation NotsupportedTableDef Read/write

Page 495: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ValueProperty

Setsorreturnsthevalueofanobject.

SettingsandReturnValues

ThesettingorreturnvalueisaVariantdatatypethatevaluatestoavalueappropriateforthedatatype,asspecifiedbytheTypepropertyofanobject.

Remarks

Generally,theValuepropertyisusedtoretrieveandalterdatainRecordsetobjects.

TheValuepropertyisthedefaultpropertyoftheField,Parameter,andPropertyobjects.Therefore,youcansetorreturnthevalueofoneoftheseobjectsbyreferringtothemdirectlyinsteadofspecifyingtheValueproperty.

TryingtosetorreturntheValuepropertyinaninappropriatecontext(forexample,theValuepropertyofaFieldobjectintheFieldscollectionofaTableDefobject)willcauseatrappableerror.

Page 496: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Notes

InanODBCDirectworkspace,youcannotreadorsettheValuepropertyofaRecordsetfieldmorethanoncewithoutrefreshingthecurrentrecord.Forexample,toreadandthensettheValueproperty,firstreadtheproperty,thenusetheMove0methodtorefreshthecurrentrecord,thenwritethenewvalue.

WhenreadingdecimalvaluesfromaMicrosoftSQLServerdatabase,theywillbeformattedusingscientificnotationthroughaMicrosoftJetworkspace,butwillappearasnormaldecimalvaluesthroughanODBCDirectworkspace.

Page 497: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

VersionProperty

MicrosoftJetworkspace?OntheDBEngineobject,returnstheversionofDAOcurrentlyinuse.OntheDatabaseobject,returnstheversionofJetthatcreatedthe.mdbfile.

ODBCDirectworkspace?OntheDBEngineobject,returnstheversionofDAOcurrentlyinuse.OntheDatabaseobject,returnstheversionoftheODBCdrivercurrentlyinuse.

ReturnValues

ThereturnvalueisaStringthatevaluatestoaversionnumber,formattedasfollows.

MicrosoftJetworkspace?representstheversionnumberintheform"major.minor".Forexample,"3.0".Theproductversionnumberconsistsoftheversionnumber(3),aperiod,andthereleasenumber(0).

Page 498: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCDirectworkspace?representstheDAOversionnumberintheform"major.minor",orrepresentstheODBCdriverversionnumberintheform"major.minor.build".Forexample,theDBEngine.Versionvalueof“3.5”indicatedDAOversion3.5.ADatabaseobject'sVersionvalueof2.50.1032indicatesthatthecurrentinstanceofDAOisconnectedtoODBCversion2.5,build1032.

Remarks

InaMicrosoftJetworkspace,theVersionpropertyofaDatabaseobjectcorrespondstoaversionoftheMicrosoftJetdatabaseengine,anddoesn’tnecessarilymatchtheversionnumberoftheMicrosoftproductwithwhichthedatabaseenginewasincluded.Forexample,theVersionpropertyofaDatabaseobjectcreatedwithMicrosoftVisualBasic3.0willbe1.1,not3.0.

ThefollowingtableshowswhichversionofthedatabaseenginewasincludedwithvariousversionsofMicrosoftproducts.

MicrosoftJetVersion(yearreleased)

MicrosoftAccess

MicrosoftVisualBasic

MicrosoftExcel

MicrosoftVisualC++

1.0(1992) 1.0 N/A N/A N/A1.1(1993) 1.1 3.0 N/A N/A2.0(1994) 2.0 N/A N/A N/A2.5(1995) N/A 4.0(16-bit) N/A N/A3.0(1995) ‘95(7.0) 4.0(32-bit) ‘95(7.0) 4.x3.5(1996) ‘97(8.0) 5.0 ‘97(8.0) 5.0

Page 499: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

VisibleValueProperty

ReturnsavaluecurrentlyinthedatabasethatisnewerthantheOriginalValuepropertyasdeterminedbyabatchupdateconflict(ODBCDirectworkspacesonly).

ReturnValues

Thereturnvalueisavariantexpression.

Remarks

Thispropertycontainsthevalueofthefieldthatiscurrentlyinthedatabaseontheserver.Duringanoptimisticbatchupdate,acollisionmayoccurwhereasecondclientmodifiedthesamefieldandrecordinbetweenthetimethefirstclientretrievedthedataandthefirstclient'supdateattempt.Whenthishappens,thevaluethatthesecondclientsetwillbeaccessiblethroughthisproperty.

Page 500: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCDirect

AtechnologythatallowsyoutoaccessODBCdatasourcesdirectlybyusingDAOfeaturesthatbypasstheMicrosoftJetdatabaseengine.

Page 501: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCdatasource

Atermusedtorefertoadatabaseordatabaseserverusedasasourceofdata.ODBCdatasourcesarereferredtobytheirDataSourceName(DSN).DatasourcescanbecreatedbyusingtheWindowsControlPanelortheRegisterDatabasemethod.

Page 502: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MicrosoftJetdatabaseengine

Adatabasemanagementsystemthatretrievesdatafromandstoresdatainuserandsystemdatabases.TheMicrosoftJetdatabaseenginecanbethoughtofasadatamanagercomponentwithwhichotherdataaccesssystems,suchasMicrosoftAccessandVisualBasic,arebuilt.

Page 503: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MicrosoftJetdatabase

AdatabasecreatedwiththeMicrosoftJetdatabaseengine.ThefilenameextensionforaMicrosoftJetdatabaseis.mdb.

Page 504: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

batchupdate

Acursormodelforclientsthatworkwithcursorsbutdon'tholdlocksontheserverorissueupdatesbyrow.Instead,theclientupdatesmanyrowsthatarebufferedlocally,andthenitissuesabatchupdate.Thiscursormodelalsoallowstheclienttodroptheconnectiontotheserverandre-establishitwiththesameserverorevenadifferentserver.

TousebatchupdatinginDAO3.5,youmustuseanODBCDirectworkspace,theDefaultCursorDriverpropertymustbesettodbUseClientBatchCursoratthetimetheConnectionisopened,andtheRecordsetmustbeopenedwiththeOpenRecordsetmethod'slocktypeargumentsettodbOptimisticBatch.

Page 505: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

collision

Aconflictthatoccursduringabatchupdate.

Acollisionoccurswhenaclientreadsdatafromtheserverandthenattemptstomodifythatdatainabatchupdate,butbeforetheupdateattemptisactuallyexecutedanotherclientchangestheoriginalserverdata.Inthissituation,thefirstclientisattemptingtomodifyserverdatawithoutknowingwhatdataactuallyexistsontheserver.

Page 506: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

replica

Acopyofadatabase,includingitstables,queries,forms,reports,macros,andmodules.Areplicaisamemberofareplicasetandcanbesynchronizedwithotherreplicasintheset.Changestothedatainareplicatedtableinonereplicaaresentandappliedtotheothermembersinthereplicaset.

NoteTheDesignMasterisalsoareplica.

Page 507: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

partialreplica

Adatabasethatcontainsonlyasubsetoftherecordsinafullreplica.Withapartialreplica,youcansetfiltersandidentifyrelationshipsthatdefinewhichsubsetoftherecordsinthefullreplicashouldbepresentinthedatabase.

Page 508: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MicrosoftJetworkspace

AworkspacethatusestheMicrosoftJetdatabaseenginetoaccessadatasource.ThedatasourcecanbeaMicrosoftJetdatabasefile(.mdb),anODBCdatabase,suchasaParadoxdatabase,oranISAMdatabase.

Page 509: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

MicrosoftJet-connectedODBCdatasource

AnODBCdatasourcethatisaccessedbyusingDataAccessObjects(DAO)andtheMicrosoftJetdatabaseengine.

Page 510: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

installableISAM

AdriveryoucanspecifythatallowsaccesstoexternaldatabaseformatssuchasdBASE,MicrosoftExcel,andParadox.ISAMisanacronymforIndexedSequentialAccessMethod.TheMicrosoftJetdatabaseengineinstalls(loads)theseISAMdriverswhenreferencedbyyourapplication.ThelocationofthesedriversismaintainedintheMicrosoftWindowsRegistry.

Page 511: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCDirectworkspace

AworkspacethatusesODBCDirecttoaccessanODBCdatasourcedirectly,bypassingtheMicrosoftJetdatabaseengine.

Page 512: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBC(OpenDatabaseConnectivity)

Astandardprotocolthatpermitsapplicationstoconnecttoavarietyofexternaldatabaseserversorfiles.ODBCdriversusedbytheMicrosoftJetdatabaseenginepermitaccesstoMicrosoftSQLServerandseveralotherexternaldatabases.

TheODBCapplicationprogramminginterface(API)mayalsobeusedtoaccessODBCdriversandthedatabasestheyconnecttowithoutusingtheMicrosoftJetdatabaseengine.

Page 513: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

asynchronousquery

AtypeofqueryinwhichSQLqueriesreturnimmediately,eventhoughtheresultsarestillpending.Thisenablesanapplicationtocontinuewithotherprocessingwhilethequeryispendingcompletion.

Page 514: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

objectvariable

Avariablethatcontainsareferencetoanobject.

Page 515: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DDL(DataDefinitionLanguage)

Thelanguageusedtodescribeattributesofadatabase,especiallytables,fields,indexes,andstoragestrategy.

Page 516: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

databasereplication

Theprocessofreproducingadatabasesothattwoormorecopies(replicas)ofthesamedatabasecanstaysynchronized.Changestothedatainareplicatedtableinonereplicaaresentandappliedtotheotherreplicasinthereplicaset.ChangesmadetothedesignofthedatabaseintheDesignMasteraresentandappliedtoallreplicasintheset.

Page 517: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

permission

Oneormoreattributesthatspecifywhatkindofaccessauserhastodataorobjectsinadatabase.Forexample,ifauserhasreaddatapermissionforatableorquery,theusercanvieworretrievebutnoteditdatainthetableorquery.

Page 518: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

method

Aproceduresimilartoafunctionthatoperatesonspecificobjects.

Page 519: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

property

Anamedattributeofanobject.Propertiesdefineobjectcharacteristicssuchassize,color,andscreenlocation,orthestateofanobject,suchasenabledordisabled.

Page 520: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

replicate

Produceareplica,orcopy,ofsomething?forexample,adatabase.

Page 521: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

exclusive

Atypeofaccessthatprotectsdatainadatabasesharedoveranetwork.Whenyouopenadatabaseinexclusivemode,youpreventothersfromopeningthedatabase.

Page 522: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

one-to-onerelationship

Anassociationbetweentwotablesinwhich:

Theprimarykeyvalueofeachrecordintheprimarytablecorrespondstothevalueinthematchingfieldorfieldsofoneandonlyonerecordintherelatedtable.

Theprimarykeyvalueofeachrecordintherelatedtablecorrespondstothevalueinthematchingfieldorfieldsofoneandonlyonerecordintheprimarytable.

Page 523: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

relationship

Anassociationestablishedbetweencommonfields(columns)intwotables.Arelationshipcanbeone-to-one,many-to-many,orone-to-many.

Page 524: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

referentialintegrity

Rulesthatyousettoestablishandpreserverelationshipsbetweentableswhenyouadd,change,ordeleterecords.Enforcingreferentialintegrityprohibitsusersfromaddingrecordstoajoinedtableforwhichthereisnoprimarykey,changingvaluesinaprimarytablethatwouldresultinorphanedrecordsinajoinedtable,anddeletingrecordsfromaprimarytablewhentherearematchingrelatedrecords.

IfyouselectthedbRelationDeleteCascadeordbRelationUpdateCascadeoptionforarelationship,theMicrosoftJetdatabaseengineallowschangesanddeletionsbutchangesordeletesrelatedrecordstomakesuretherulesarestillenforced.

Page 525: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

linkedtable

AtableinanotherdatabaselinkedtoaMicrosoftJetdatabase.Dataforlinkedtablesremainsintheexternaldatabasewhereitcanbemanipulatedbyotherapplications.(Formerlyknownasattachedtables.)

Page 526: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

server-sidecursor

Cursorsthatresideontheserver,asopposedtoresidingontheclientcomputer.Whileclient-sidecursorscopythecursortotheworkstation,server-sidecursorsusetheresourcesofthedatabaseservertomaintainthecursors.

Page 527: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

replicateddatabase

Adatabasetowhichadditionaltables,fields,andpropertieshavebeenaddedtorecordinformationaboutchangestodataandthedesignofreplicatedobjectsinthedatabase.

Page 528: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

actionquery

Aquerythatcopiesorchangesdata.Actionqueriesincludeappend,delete,make-table,andupdatequeries.Deleteandupdatequerieschangeexistingdata;appendandmake-tablequeriescopyexistingdata.Incontrast,selectqueriesreturndatarecords.AnSQLpass-throughquerymayalsobeanactionquery.

Page 529: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

appendquery

Anactionquerythataddsnewrecordstotheendofanexistingtableorquery.Appendqueriesdon'treturnrecords(rows).

Page 530: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

compoundquery

Aquerythatiscomposedofatleastoneactionquery(aquerythatcopiesorchangesdata)andatleastoneselectquery(aquerythatreturnsaRecordsetwithoutchangingdata).InDAO,acompoundqueryiscreatedbyputtingtwoormoreSQLstatements(separatedbysemicolons)intheSQLpropertyofaQueryDefobject.

Page 531: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

crosstabquery

Aquerythatcalculatesasum,average,count,orothertypeoftotalonrecords,andthengroupstheresultbytwotypesofinformation?onedowntheleftsideofagrid(rowheadings)andtheotheracrossthetop(columnheadings).Forexample,theQuarterlyOrdersbyProductqueryintheNorthwindsampledatabaseisacrosstabquery.

Page 532: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

data-definitionquery

AnSQL-specificquerythatcancreate,alter,ordeleteatable,orcreateordeleteanindexinadatabase.

Page 533: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

deletequery

Anactionquerythatdeletesasetofrowsthatmatchthecriteriayouspecify.Adeletequerydoesn’treturnrows.

Page 534: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

make-tablequery

AnactionquerythatcreatesanewtablefromtheRecordsetobjectofanexistingquery.

Page 535: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

selectquery

AquerythatasksaquestionaboutthedatastoredinyourtablesandreturnsaRecordsetobjectwithoutchangingthedata.OncetheRecordsetdataisretrieved,youcanexamineandmakechangestothedataintheunderlyingtables.Incontrast,actionqueriescanmakechangestoyourdata,buttheydon'treturndatarecords.

Page 536: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

pass-throughquery

AnSQL-specificqueryyouusetosendcommandsdirectlytoaSQLdatabaseserver(suchasMicrosoftSQLServer).Withpass-throughqueries,youworkwiththetablesontheserverinsteadoflinkingthem.Pass-throughqueriesareusedtoexecuteSQLqueriesandsystem-specificcommandswrittenbyusingSQLdialectsknownonlytotheserver.

Apass-throughquerymayormaynotreturnrecords.Ifitdoes,theyarealwaysreturnedinasnapshot.

Page 537: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

updatequery

Anactionquerythatchangesasetofrecordsaccordingtocriteriayouspecify.Anupdatequerydoesn’treturnanyrecords.

Page 538: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

inconsistent

Thestateofamultiple-tableRecordsetobjectthatenablesyoutoupdateallfields(columns).Forexample,inaRecordsetcreatedbyjoiningtwotablesinaone-to-manyjoin(asinaCustomersandOrderstable),youcanupdateOrders.CustomerIDsothatitdoesn’tmatchCustomers.CustomerID,unlessreferentialintegritydisablestheupdate.

Page 539: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

consistent

Thestateofamultiple-tableRecordsetobjectthatallowsyoutoperformonlyupdatesthatresultinaconsistentviewofthedata.Forexample,inaRecordsetthatisajoinoftwoormoretables(aone-to-manyrelationship),aconsistentquerywouldnotallowyoutosetthemany-sidekeytoavaluethatisn’tintheone-sidetable.

Page 540: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCDriverManager

AnapplicationthatmanagesconnectionsbetweenODBC-enableddatasourcesandthedriversusedtoaccessthem.

Page 541: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

connectionstring

Astringusedtodefinethesourceofdataforanexternaldatabase.TheconnectionstringisusuallyassignedtotheConnectpropertyofaQueryDef,TableDef,Connection,orDatabaseobjectorasanargumenttotheOpenDatabasemethod.

Page 542: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dynaset

AtypeofRecordsetobjectthatreturnsadynamicsetofpointerstolivedatabasedata.Likeatable-orasnapshot-typeRecordset,adynasetreturnsdatainrecords(rows)andfields(columns).Unlikeatable-typeRecordset,adynaset-typeRecordsetcanbetheresultofaquerythatjoinstwoormoretables.Therecordsinadynaset-typeRecordsetobjectareupdatableiftheUpdatablepropertyoftheRecordsetisTrue,theFieldbeingchangedisupdatable,andthedatapagecontainingthecurrentrecordisn’tlocked.ThedatapageislockedwhentheUpdatemethodisused(whentheLockEditspropertyisFalse),ortheEditmethodisused(whentheLockEditspropertyisTrue).

Page 543: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

SQLstatement/string

AnexpressionthatdefinesaStructuredQueryLanguage(SQL)command,suchasSELECT,UPDATE,orDELETE,andmayincludeclausessuchasWHEREandORDERBY.SQLstringsandstatementsaretypicallyusedinqueries,Recordsetobjects,andaggregatefunctionsbutcanalsobeusedtocreateormodifyadatabasestructure.

Page 544: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DAOobject

AnobjectthatisdefinedbytheDataAccessObjects(DAO)library.YoucanuseDAOobjects,suchastheDatabase,TableDef,Recordset,andQueryDefobjects,torepresentobjectsthatareusedtoorganizeandmanipulatedata,suchastablesandqueries,incode.

Page 545: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

group

AcollectionofuseraccountsinaWorkgroupobject,identifiedbygroupnameandpersonalidentifier(PID).Permissionsassignedtoagroupapplytoallusersinthegroup.

Page 546: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

parameterquery

Aquerythatrequiresyoutoprovideoneormorecriteriavalues,suchasRedmondforCity,beforethequeryisrun.Aparameterqueryisn’t,strictlyspeaking,aseparatekindofquery;rather,itextendstheflexibilityofotherqueries.

Page 547: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

basetable

AtableinaMicrosoftJetdatabase.Atabledefinesthestructureofarelationaldatabase,andisanobjectthatstoresdatainrecordsandfields.YoucanmanipulatethestructureofabasetablebyusingtheDAOobjectsordatadefinitionSQLstatements,andyoucanmodifydatainabasetablebyusingRecordsetobjectsoractionqueries.

Page 548: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

useraccount

Anaccountidentifiedbyausernameandpersonalidentifier(PID)thatiscreatedtomanageaccesstodatabaseobjectsinaMicrosoftJetdatabaseWorkgroupobject.

Page 549: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

session

AsessiondelineatesasequenceofoperationsperformedbytheMicrosoftJetdatabaseengine.Asessionbeginswhenauserlogsonandendswhenauserlogsoff.Alloperationsperformedduringasessionformonetransactionscopeandaresubjecttopermissionsdeterminedbythelogonusernameandpassword.SessionsareimplementedasWorkspaceobjectsbyDAO.

Page 550: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

persistentobject

Anobjectstoredinthedatabase;forexample,adatabasetableorQueryDefobject.Dynaset-typeorsnapshot-typeRecordsetobjectsarenotconsideredpersistentobjectsbecausetheyarecreatedinmemoryasneeded.

Page 551: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

transaction

Aseriesofchangesmadetoadatabase'sdataandschema.MarkthebeginningofatransactionwiththeBeginTransstatement,committhetransactionbyusingtheCommitTransstatement,andundoallyourchangessinceBeginTransbyusingtheRollbackstatement.

Transactionsareoptionalandcanbenesteduptofivelevels.Transactionsincreasethespeedofoperationsthatchangedataandenableyoutoreversechangeseasily.

Transactionsareglobaltothereferenceddatabaseobject'sWorkspace.

Page 552: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DataAccessObjects(DAO)

Aprogramminginterfacetoaccessandmanipulatedatabaseobjects.

Page 553: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

dynamiccursor

Adynamicsetofrowsthatyoucanusetoadd,change,ordeleterowsfromanunderlyingdatabasetableortables.Adynamiccursorcancontaincolumnsfromoneormoretablesinadatabase.Membershipisnotfixed.

Page 554: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Dynaset-TypeRecordsetObject

Adynaset-typeRecordsetobjectisadynamicsetofrecordsthatcancontainfieldsfromoneormoretablesorqueriesinadatabaseandmaybeupdatable.InanODBCDirectdatabase,adynaset-typeRecordsetobjectcorrespondstoanODBCkeysetcursor.

Remarks

Adynaset-typeRecordsetobjectisatypeofRecordsetobjectyoucanusetomanipulatedatainanunderlyingdatabasetableortables.

Itdiffersfromasnapshot-typeRecordsetobjectbecausethedynasetstoresonlytheprimarykeyforeachrecord,insteadofactualdata.Asaresult,adynasetisupdatedwithchangesmadetothesourcedata,whilethesnapshotisnot.Likethetable-typeRecordsetobject,adynaset

Page 555: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

retrievesthefullrecordonlywhenit'sneededforeditingordisplaypurposes.

Tocreateadynaset-typeRecordsetobject,usetheOpenRecordsetmethodonanopendatabase,againstanotherdynaset-orsnapshot-typeRecordsetobject,onaQueryDefobject,oronaTableDefobject.(OpeningRecordsetobjectsonotherRecordsetobjectsorTableDefobjectsisavailableonlyinMicrosoftJetworkspaces.)

Ifyourequestadynaset-typeRecordsetobjectandtheMicrosoftJetdatabaseenginecan'tgainread/writeaccesstotherecords,theMicrosoftJetdatabaseenginemaycreatearead-only,dynaset-typeRecordsetobject.

Asusersupdatedata,thebasetablesreflectsthesechanges.Therefore,currentdataisavailabletoyourapplicationwhenyourepositionthecurrentrecord.Inamultiuserdatabase,morethanoneusercanopenadynaset-typeRecordsetobjectreferringtothesamerecords.Becauseadynaset-typeRecordsetobjectisdynamic,whenoneuserchangesarecord,otherusershaveimmediateaccesstothechangeddata.However,ifoneuseraddsarecord,otheruserswon’tseethenewrecorduntiltheyusetheRequerymethodontheRecordsetobject.Ifauserdeletesarecord,otherusersarenotifiedwhentheytrytoaccessit.

Recordsaddedtothedatabasedon'tbecomeapartofyourdynaset-typeRecordsetobjectunlessyouaddthembyusingtheAddNewandUpdatemethods.Forexample,ifyouuseanactionquerycontaininganINSERTINTOSQLstatementtoaddrecords,thenewrecordsaren'tincludedinyourdynaset-typeRecordsetobjectuntilyoueitherusetheRequerymethodoryourebuildyourRecordsetobjectusingtheOpenRecordsetmethod.

Tomaintaindataintegrity,theMicrosoftJetdatabaseenginecanlockdynaset-andtable-typeRecordsetobjectsduringEdit(pessimisticlocking)orUpdateoperations(optimisticlocking)sothatonlyoneusercanupdateaparticularrecordatatime.WhentheMicrosoftJetdatabaseenginelocksarecord,itlockstheentire2Kpagecontainingtherecord.

Page 556: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Youcanalsouseoptimisticandpessimisticlockingwithnon-ODBCtables.WhenyouaccessexternaltablesusingODBCthroughaMicrosoftJetworkspace,youshouldalwaysuseoptimisticlocking.TheLockEditspropertyandthelockeditsparameteroftheOpenRecordsetmethoddeterminethelockingconditionsduringediting.

Notallfieldscanbeupdatedinalldynaset-typeRecordsetobjects.Todeterminewhetheryoucanupdateaparticularfield,checktheDataUpdatablepropertysettingoftheFieldobject.

Adynaset-typeRecordsetobjectmaynotbeupdatableif:

Thereisn'tauniqueindexontheODBCorParadoxtableortables.

Thedatapageislockedbyanotheruser.

Therecordhaschangedsinceyoulastreadit.

Theuserdoesn'thavepermission.

Oneormoreofthetablesorfieldsareread-only.

Thedatabaseisopenedasread-only.

TheRecordsetobjectwaseithercreatedfrommultipletableswithoutaJOINstatementorthequerywastoocomplex.

Theorderofadynaset-typeRecordsetobjectorRecordsetdatadoesn'tnecessarilyfollowanyspecificsequence.Ifyouneedtoorderyourdata,useanSQLstatementwithanORDERBYclausetocreatethe

Page 557: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Recordsetobject.YoucanalsouseaWHEREclausetofiltertherecordssothatonlycertainrecordsareaddedtotheRecordsetobject.UsingSQLstatementsinthiswaytoselectasubsetofrecordsandorderthemusuallyresultsinfasteraccesstoyourdatathanusingtheFilterandSortproperties.

Page 558: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Longdatatype

Afundamentaldatatypethatholdslong-integernumbers.ALongvariableisstoredasa32-bit(4-byte)numberranginginvaluefrom-2,147,483,648to2,147,483,647.

Page 559: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

HelpContext,HelpFileProperties

HelpContext—returnsacontextID,asaLongvariable,foratopicinaMicrosoftWindowsHelpfile.

HelpFile—returnsaStringthatisafullyqualifiedpathtotheHelpfile.

Remarks

IfyouspecifyaMicrosoftWindowsHelpfileinHelpFile,youcanusetheHelpContextpropertytoautomaticallydisplaytheHelptopicitidentifies.

NoteYoushouldwriteproceduresinyourapplicationtohandletypicalerrors.Whenprogrammingwithanobject,youcanusetheHelpsuppliedbytheobject'sHelpfiletoimprovethequalityofyourerrorhandling,ortodisplayameaningfulmessagetoyouruseriftheerrorisnotrecoverable.

Page 560: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

currentrecord

TherecordinaRecordsetobjectthatyoucanusetomodifyorexaminedata.UsetheMovemethodstorepositionthecurrentrecordinarecordset.UsetheFindmethods(withadynaset-orsnapshot-typeRecordsetobject)ortheSeekmethod(withatable-typeRecordsetobject)tochangethecurrentrecordpositionaccordingtospecificcriteria.

OnlyonerecordinaRecordsetcanbethecurrentrecord;however,aRecordsetmayhavenocurrentrecord.Forexample,afteradynaset-typeRecordsetrecordhasbeendeleted,orwhenaRecordsethasnorecords,thecurrentrecordisundefined.Inthiscase,operationsthatrefertothecurrentrecordresultinatrappableerror.

Page 561: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

datatype

Thecharacteristicsofavariablethatdeterminewhatkindofdatathevariablecanhold.DatatypesincludeBigInteger,Binary,Byte,Boolean,Char,Currency,Date,Decimal,Double,Float,GUID,Integer,Long,LongBinary(OLEObject),Memo,Numeric,Single,String,Text,Time,TimeStamp,VarBinary,Variant(default),user-definedtypes(createdwiththeTypestatement),andobjectdatatypes,whichincludehost-definedobjectdatatypesandDAOobjecttypes.

Page 562: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

OLEObjectdatatype

AfielddatatypeyouuseforobjectscreatedinotherapplicationsthatcanbelinkedorembeddedinaMicrosoftJetdatabase.Forexample,youcoulduseanOLEObjectfieldtostoreacollectionofpictures.

Page 563: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Memodatatype

Afielddatatype.Suchfieldscancontainupto1.2GBoftextdata.

Page 564: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

forward-onlycursor

Aresultsetwherethecurrentpositioncanonlymoveforwardbyaspecifiednumberofrecords,ortotheverylastrecord.Thecurrentpositioncannotbemovedbacktothebeginningoftheresultsetortopreviousrecords.Thecursormembership,order,andvaluesaregenerallyfixedwhenthecursorisopened.Ifotherusersupdate,delete,orinsertrows,thecursordoesn'treflectthesechangesuntilyoucloseandreopenit.

Page 565: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

secureworkgroup

AMicrosoftJetdatabaseWorkgroupobjecttowhichuserslogonwithausernameandpasswordandinwhichaccesstodatabaseobjectsisrestrictedaccordingtopermissionsspecifiedforuseraccountsandgroups.

Page 566: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Null

Avaluethatindicatesmissingorunknowndata.Nullvaluescanbeenteredinfieldsforwhichinformationisunknownandinexpressionsandqueries.InVisualBasic,theNullkeywordindicatesaNullvalue.Somefields,suchasthosedefinedascontainingtheprimarykey,can’tcontainNullvalues.

Page 567: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

join

Adatabaseoperationthatcombinessomeorallrecordsfromtwoormoretables,suchasanequi-join,outerjoin,orself-join.Generally,ajoinreferstoanassociationbetweenafieldinonetableandafieldofthesamedatatypeinanothertable.YoucreateajoinwithanSQLstatement.

Whenyoudefinearelationshipbetweentwotables,youcreateajoinbyspecifyingtheprimaryandforeigntablefields.Whenyouaddatabletoaquery,youneedtocreateajoinbetweenappropriatefieldsintheSQLstatementthatdefinesthequery.

Page 568: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

primarykey

Oneormorefieldswhosevalueorvaluesuniquelyidentifyeachrecordinatable.Inarelationship,aprimarykeyisusedtorefertospecificrecordsinonetablefromanothertable.Aprimarykeyiscalledaforeignkeywhenitisreferredtofromanothertable.Youcanhaveonlyoneprimarykey.AnEmployeestable,forexample,couldusethesocialsecuritynumberfortheprimarykey.

Page 569: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

foreignkey

Oneormoretablefieldsthatrefertotheprimarykeyfieldorfieldsinanothertable.Aforeignkeyindicateshowthetablesarerelated?thedataintheforeignkeyandprimarykeyfieldsmustmatch.Forexample,alistofvalidpartnumberswouldcontainaforeignkeytoaninventorytablecontainingreferencestovalidpartnumbers.Usedwhenestablishingreferentialintegrityforadatabase.

Page 570: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

cascadingupdate

Forrelationshipsenforcingreferentialintegritybetweentables,anoptionthatcausesachangetotheprimarykeyinarecordintheprimarytabletoautomaticallyupdatetheforeignkeyinallrelatedrecordsintherelatedforeigntableortables.

Forexample,supposeyouestablisharelationshipbetweenaCustomers(primary)tableandanOrders(foreign)tablewiththecascadingupdateoptionenabled.WhentheprimarykeyinarecordintheCustomerstableischanged,allordersassociatedwiththatcustomerwouldalsobechangedintheforeignOrderstable.

Page 571: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

cascadingdelete

Forrelationshipsthatenforcereferentialintegritybetweentables,anoptionthatcausesthedeletionofarecordfromtheprimarytabletoautomaticallydeleteallrelatedrecordsintherelatedforeigntableortables.

Forexample,supposeyouestablisharelationshipbetweenaCustomers(primary)tableandanOrders(foreign)tablewiththecascadingdeleteoptionenabled.WhenarecordintheCustomerstableisdeleted,allordersassociatedwiththatcustomerwouldalsobedeletedintheforeignOrderstable.

Page 572: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Stringdatatype

Afundamentaldatatypethatholdscharacterinformation.AStringvariableiseitherfixed-lengthorvariable-lengthandcontainsonecharacterperbyte.Fixed-lengthstringsaredeclaredtobeaspecificlengthandcancontain1toapproximately64K(2^16)characters.Variable-lengthstringscanbeanylengthupto2billion(2^31)characters(approximately64K[2^16]charactersforMicrosoftWindowsversion3.1andearlier),lessasmallamountofstorageoverhead.

Page 573: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Integerdatatype

Afundamentaldatatypethatholdsintegernumbers.AnIntegervariableisstoredasa16-bit(2-byte)numberranginginvaluefrom-32,768to32,767.

Page 574: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Variantdatatype

Aspecialdatatypethatcancontainnumeric,string,ordatedataaswellasthespecialvaluesEmptyandNull.TheVarTypefunctiondefineshowthedatainaVariantistreated.Allvariablesbecomevarianttypesifnotexplicitlydeclaredassomeothertype.

Page 575: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Booleandatatype

ATrue/Falseoryes/novalue.BooleanvaluesareusuallystoredinBitfieldsinaMicrosoftJetdatabase;however,somedatabasesdon'tsupportthisdatatypedirectly.

Page 576: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

zero-lengthstring

Astringcontainingnocharacters("").TheLenfunctionofazero-lengthstringreturns0.

Page 577: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

query

Aformalizedinstructiontoadatabasetoeitherreturnasetofrecordsorperformaspecifiedactiononasetofrecordsasspecifiedinthequery.Forexample,thefollowingSQLquerystatementreturnsrecords:

SELECTCompanyNameFROMPublishersWHERERegion='NY'

Youcancreateandrunselect,action,crosstab,parameter,andSQL-specificqueries.

Page 578: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

record

Asetofrelateddataaboutaperson,place,event,orsomeotheritem.Tabledataisstoredinrecords(rows)inthedatabase.Eachrecordiscomposedofasetofrelatedfields(columns)?eachfielddefiningoneattributeofinformationfortherecord.Takentogether,arecorddefinesonespecificunitofretrievableinformationinadatabase.

Page 579: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

field

Acategoryofinformationstoredinatableinadatabase?acolumnofdata.Anelementofadatabasetablethatcontainsaspecificitemofinformation,suchaslastname.

Page 580: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

keysetcursor

Asetofrowsthatyoucanusetoadd,change,ordeleterowsfromanunderlyingdatabasetableortables.Movementwithinthekeysetisunrestricted.Akeysetcursorcancontaincolumnsfromoneormoretablesinadatabase.Membershipisfixed.

Page 581: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

staticcursor

Aresultsetwherethemembership,order,andvaluesaregenerallyfixedwhenthecursorisopened.Ifotherusersupdate,delete,orinsertrows,thecursordoesn'treflectthesechangesuntilyoucloseandreopenit.

Page 582: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

scope

Theattributeofavariableorprocedurethatdetermineswhichsectionsofwhichmodulesrecognizeit.Therearethreelevelsofscope:public,module,andprocedure.VariablesthatyoudeclarewithPubliccanbeaccessedbyanymodule,whilevariablesthatyoudeclareinaspecificmodulecanbeusedonlywithinthatmodule.Also,variablesthatyoudeclareinaSuborFunctionprocedurecanbeusedonlyinthatparticularprocedure.

Page 583: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TEMP

ATEMPenvironmentvariableissetbyyourautoexec.batfilewhenyoustartyoursystem.Generally,TEMPpointstoanareaonyourharddiskusedbyMicrosoftWindowsandotherprograms,liketheMicrosoftJetdatabaseengine,tostoreinformationthatdoesn'tneedtobesavedafteryoushutdownyoursystem.Forexample,thefollowinglineinyourautoexec.batfilepointstheTEMPenvironmentvariabletotheD:\TempAreafolder:

SETTEMP=D:\TempArea

Page 584: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

primarytable

The"one"sideoftworelatedtablesinaone-to-manyrelationshipwithaforeigntable.Generally,aprimarykeytableisusedtoestablishorenforcereferentialintegrity.

Page 585: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

foreigntable

Atablethatprovidesaforeignkeytoanothertableinthedatabase.Generally,youuseaforeigntabletoestablishorenforcereferentialintegrity.Theforeigntableisusuallyonthe"many"sideofaone-to-manyrelationship.Anexampleofaforeigntableisatableofcustomerorders.

Page 586: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

one-to-manyrelationship

Anassociationbetweentwotablesinwhich:

Theprimarykeyvalueofeachrecordintheprimarytablecorrespondstothevalueinthematchingfieldorfieldsofmanyrecordsintherelatedtable.

Theprimarykeyvalueofeachrecordintherelatedtablecorrespondstothevalueinthematchingfieldorfieldsofoneandonlyonerecordintheprimarytable.

Page 587: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

leftjoin

Aleftouterjoinincludesalloftherecordsfromthefirst(left)oftwotables,eveniftherearenomatchingvaluesforrecordsinthesecond(right)table.

Page 588: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

rightjoin

Arightouterjoinincludesalloftherecordsfromthesecond(right)oftwotables,eveniftherearenomatchingvaluesforrecordsinthefirst(left)table.

Forexample,youcoulduseLEFTJOINwiththeDepartments(left)andEmployees(right)tablestoselectalldepartments,includingthosethathavenoemployeesassignedtothem.Toselectallemployees,includingthosewhoaren'tassignedtoadepartment,youwoulduseRIGHTJOIN.

Page 589: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

index

Adynamiccross-referenceofoneormoretabledatafields(columns)thatpermitsfasterretrievalofspecificrecordsfromatable.Asrecordsareadded,changed,ordeleted,thedatabasemanagementsystemautomaticallyupdatestheindextoreflectthechanges.

Whenusedwithatable-typeRecordsetobject,thecurrentindexdeterminestheorderinwhichdatarecordsarereturnedtotheRecordset.Atablemayhaveseveralindexesdefinedforitsdata.

ADAOIndexobjectrepresentsanindexforaTableDefobject.

Page 590: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

locked

Theconditionofadatapage,Recordsetobject,orDatabaseobjectthatmakesitread-onlytoallusersexcepttheonewhoiscurrentlyenteringdatainit.

Page 591: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

page

Aportionofthedatabaseinwhichrecorddataisstored.Dependingonthesizeoftherecords,apagemaycontainmorethanonerecord.InMicrosoftJetdatabases(.mdb),apageis2048(2K)bytesinlength.

Page 592: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

pessimistic

Atypeoflockinginwhichthepagecontainingoneormorerecords,includingtherecordbeingedited,isunavailabletootheruserswhenyouusetheEditmethod,andremainsunavailableuntilyouusetheUpdatemethod.PessimisticlockingisenabledwhentheLockEditspropertyoftheRecordsetobjectissettoTrue.

Page 593: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

optimistic

Atypeoflockinginwhichthedatapagecontainingoneormorerecords,includingtherecordbeingedited,isunavailabletootherusersonlywhiletherecordisbeingupdatedbytheUpdatemethod,butisavailablebetweentheEditandUpdatemethods.OptimisticlockingisusedwhenaccessingODBCdatabasesorwhentheLockEditspropertyoftheRecordsetobjectissettoFalse.

Page 594: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

defaultworkspace

TheWorkspaceobjectthatDAOautomaticallyestablisheswhenyourapplicationfirstreferencesanyDAOobject.ThisWorkspaceisreferencedbyDBEngine.Workspaces(0)orsimplyWorkspaces(0).

Page 595: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

sortorder

Asequencingprincipleusedtoorderdata,alphabeticallyornumerically.Thesortordercanbeeitherascendingordescending.

Page 596: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

bookmark

ApropertyoftheRecordsetobjectthatcontainsabinarystringidentifyingthecurrentrecord.IfyouassigntheBookmarkvaluetoavariableandthenmovetoanotherrecord,youcanmaketheearlierrecordcurrentagainbysettingtheBookmarkpropertytothatstringvariable.

Page 597: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

collection

Anobjectthatcontainsasetofrelatedobjects.Anobject'spositioninthecollectioncanchangewheneverachangeoccursinthecollection;therefore,thepositionofanyspecificobjectinthecollectionmayvary.

Page 598: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

stringexpression

Anyexpressionthatevaluatestoasequenceofcontiguouscharacters.Elementsoftheexpressioncanincludeafunctionthatreturnsastring,astringliteral,astringconstant,astringvariable,astringVariant,orafunctionthatreturnsastringVariant(VarType8).

Page 599: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

LongBinarydatatype

Atypeoffieldthatcanhold1.2GBofdata.LongBinaryfieldscancontainanytypeofbinarydata.(AlsoknownasanOLEObjectdatatypeinMicrosoftAccess).

Page 600: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

currenttransaction

AllchangesmadetoaRecordsetobjectafteryouusethelastBeginTransmethodandbeforeyouusetheRollbackorCommitTransmethod.

Page 601: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

update

Theprocessthatsaveschangestodatainarecord.Untiltherecordissaved,changesarestoredinatemporaryrecordcalledthecopybuffer.TheUPDATEclauseinanSQLstatementchangesdatavaluesinoneormorerecords(rows)inadatabasetable.

Page 602: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

forward-only–typeRecordset

ARecordsetobjectinwhichrecordscanbesearchedonlyfrombeginningtoend;thecurrentrecordpositioncan'tbemovedbacktothefirstrecord.Forward-only–typerecordsetsreduceprocessingoverheadonremotedatabases.Forexample,youcanuseaforward-only–typeRecordsetonalinkedremotetabletoquicklyprocessdatainonepass,suchaswhenyou’rebuildingacustomizedreport.

Page 603: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

personalidentifier(PID)

Acase-sensitivealphanumericstring4-20characterslongthattheMicrosoftJetdatabaseengineusesincombinationwiththeaccountnametoidentifyauserorgroupinaWorkgroupobject.YouprovidethePIDandtheaccountnamewhenyoucreateanewuserorgroup.

Page 604: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

replicatedobject

Atable,query,form,report,macro,ormodulethatisinallreplicasinthereplicaset.YoucanchangethereplicatedobjectonlyattheDesignMaster,andthesechangesaredispersedtootherreplicasinthereplicasetduringasynchronization.

Page 605: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

localobject

Atable,query,form,report,macro,ormodulethatremainsinthereplicawhereitwascreated.Neithertheobjectnorchangestotheobjectaredispersedtoothermembersinthereplicaset.

Page 606: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ASCIICharacterSet

AmericanStandardCodeforInformationInterchange(ASCII)7-bitcharactersetwidelyusedtorepresentlettersandsymbolsfoundonastandardU.S.keyboard.TheASCIIcharactersetisthesameasthefirst128characters(0?127)intheANSIcharacterset.

Page 607: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

copybuffer

AlocationcreatedbytheMicrosoftJetdatabaseengineforthecontentsofarecordthatisopenforediting.TheEditmethodcopiesthecurrentrecordtothecopybuffer;theAddNewmethodclearsthebufferforanewrecordandsetsthedefaultvalues;andtheUpdatemethodsavesthedatafromthecopybuffertothedatabase,replacingthecurrentrecordorinsertingthenewrecord.Anystatementthatresetsormovesthecurrentrecordpointerdiscardsthecopybuffer.Forexample,usingtheMoveNextmethodorchangingtheIndexpropertyofatablewoulddiscardthecontentsofthecopybuffer.

Page 608: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

array

Avariablethatcontainsafinitenumberofelementsthathaveacommonnameanddatatype.Eachelementofanarrayisidentifiedbyauniqueindexnumber.Changesmadetooneelementofanarraydonotaffecttheotherelements.

Page 609: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

run-timeerror

Anerrorthatoccurswhencodeisrunning.Arun-timeerrorresultswhenastatementattemptsaninvalidoperation.

Page 610: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

replicaset

Replicasthatsharethesamedatabasedesignanduniquereplicasetidentifier.Synchronizationoccursbetweenreplicasetmembers.

Page 611: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

currentindex

Foranindexedtable-typeRecordsetobject,theindexmostrecentlysetwiththeIndexproperty.Thisindexisthebasisfororderingrecordsinatable-typeRecordset,andisusedbytheSeekmethodtolocaterecords.ARecordsetobjectcanhavemorethanoneindexbutcanuseonlyoneindexatatime(althoughaTableDefobjectmayhaveseveralindexesdefinedonit).TheMicrosoftJetdatabaseenginemayusemorethanoneindextoevaluateaquery.

Page 612: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

case-sensitive

Capableofdistinguishingbetweenuppercaseandlowercaseletters.Acase-sensitivesearchfindsonlytextthatisanexactmatchofuppercaseandlowercaseletters.Suchasearchwould,forinstance,treat“ZeroLengthStr”and“zerolengthstr”asdifferent.MicrosoftJetdatabaseoperationsarenotcase-sensitive.However,casesensitivityisafeatureofsomeotherdatabasemanagementsystems.

Page 613: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCdriver

Adynamic-linklibrary(DLL)usedtoconnectaspecificOpenDatabaseConnectivitydatasourcewithanother(client)application.

Page 614: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DLL(dynamic-linklibrary)

Asetofroutinesthatcanbecalledfromproceduresandareloadedandlinkedintoyourapplicationatruntime.

Page 615: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

fielddatatypes

ThefollowingtableliststheFielddatatypes.

DAOFielddatatype ConstantBigInteger dbBigIntBinary dbBinaryBoolean dbBooleanByte dbByteChar dbCharCurrency dbCurrencyDate/Time dbDateDecimal dbDecimalDouble dbDoubleFloat dbFloatGUID dbGUIDInteger dbIntegerLong dbLongLongBinary(OLEObject) dbLongBinaryMemo dbMemoNumeric dbNumericSingle dbSingleText dbTextTime dbTimeTimeStamp dbTimeStampVarBinary dbVarBinary

Page 616: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Internet

Aworldwidenetworkofthousandsofsmallercomputernetworksandmillionsofcommercial,educational,government,andpersonalcomputers.TheInternetislikeanelectroniccitywithvirtuallibraries,storefronts,businessoffices,artgalleries,andsoon.

Page 617: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

DesignMaster

Adatabasetowhichsystemtables,systemfields,andreplicationpropertieshavebeenadded.ADesignMasteristhefirstreplicainareplicaset.YoucanmakechangestothedatabasestructureonlywiththeDesignMaster.ReplicasinthesamereplicasetcantaketurnsbeingtheDesignMaster,buttherecanbeonlyoneDesignMasteratatimeineachreplicaset.

Page 618: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

synchronization

Theprocessofupdatingtworeplicasinwhichallupdatedrecordsandobjectsareexchanged.Theexchangeofdatabetweentworeplicascanbeone-wayortwo-wayandmaybehandledbyaSynchronizer.

Page 619: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Textdatatype

Afielddatatype.Textfieldscancontainupto255charactersorthenumberofcharactersspecifiedbytheSizepropertyoftheFieldobject,whicheverisless.IftheSizepropertyofthetextfieldissetto0,thetextfieldcanholdupto255charactersofdata.

Page 620: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

currentdatabase

TheDatabaseobjectreturnedbytheCurrentDB()function.AreferenceofDBEngine.Workspaces(0).Databases(0)returnsthefirstdatabaseopened.ThisconceptappliesonlytoMicrosoftAccess.

Page 621: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

variantexpression

Anyexpressionthatcanevaluatetonumeric,string,ordatedataaswellasthespecialvaluesEmptyandNull.

Page 622: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Bytedatatype

Afundamentaldatatypeusedtoholdsmallpositiveintegernumbersrangingfrom0to255.

Page 623: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

ODBCDirectdatasource

AdatasourcethatisaccessedbyusingtheDAOODBCDirectfeatures,whichbypasstheMicrosoftJetdatabaseengine.

Page 624: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

clusteredindex

Thephysicalorderofrowsisthesameastheindexedorderofrows.

Page 625: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

stringcomparison

Theuseofanoperatortodeterminewhetheronestringisgreaterthanorequaltoanotherstring.IfyouuseOptionCompareTextintheDeclarationssectionofamodule,stringcomparisonsarenotcase-sensitive.IfyouuseOptionCompareBinary,comparisonsarecase-sensitive.IfyouuseOptionCompareDatabase,thecomparisonmethodissetbythecurrentdatabase.

Page 626: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

conflicttable

Atablethatisgeneratedwhenasynchronizationconflictoccursbetweentworeplicas.Theconflicttableappearsonlyinthereplicawithrejectedchanges.

Page 627: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

objectexpression

Anexpressionthatspecifiesaparticularobject.Thisexpressioncanincludeanyoftheobject'scontainers.Forexample,ifyourapplicationhasanApplicationobjectthatcontainsaDocumentobjectthatcontainsaTextobject,thefollowingarevalidobjectexpressions:

Application.Document.TextApplication.TextDocument.TextText

Page 628: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

expression

Anycombinationofoperators,constants,literalvalues,functions,andnamesoffields,controls,andpropertiesthatevaluatestoasinglevalue.Youcanuseexpressionsassettingsformanypropertiesandactionarguments,tosetcriteria,ordefinecalculatedfieldsinqueries.

Page 629: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

aggregatefunction

Afunction,suchasSum,Count,Avg,andVar,thatyoucanusetocalculatetotals.Inwritingexpressionsandinprogramming,youcanuseSQLaggregatefunctions(includingthefourlistedhere)anddomainaggregatefunctionstodeterminevariousstatistics.

Page 630: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

AutoNumberfield

Afielddatatypethatautomaticallystoresauniquenumberforeachrecordasit'saddedtoatable.AnAutoNumberfieldalwaysusestheLongdatatype,andnumbersgeneratedbyanAutoNumberfieldcan'tbemodified.(AlsoknownasaCounterfield.)

Page 631: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

GUIDdatatype

GloballyUniqueIdentifier/UniversallyUniqueIdentifier.Auniqueidentificationstringusedwithremoteprocedurecalls.EveryinterfaceandobjectclassusesaGUIDforidentification.AGUIDisa128-bitvalue.Forexample,12345678-1234-1234-1234-123456789ABCisasyntacticallycorrectGUID.TheGUIDsontheclientandservermustmatchfortheclientandservertobind.VendorsofobjectscanrequestthatMicrosoftallocateoneormoresetsof256GUIDsfortheirexclusiveuse.Alternatively,ifyouhaveanetworkcard,youcanrunatoolnamedUuidgen.exe,whichprovidesasetof256GUIDsbasedonthetimeofday,thedate,andauniquenumbercontainedinyournetworkcard.

Page 632: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

filter

Asetofcriteriaappliedtorecordsinordertocreateasubsetoftherecords.

Page 633: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

instance

Anyoneofasetofobjectssharingthesameclass.Forexample,multipleinstancesofaFormclasssharethesamecodeandareloadedwiththesamecontrolswithwhichtheFormclasswasdesigned.Duringruntime,theindividualpropertiesofcontrolsoneachinstancecanbesettodifferentvalues.

Page 634: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Singledatatype

Afundamentaldatatypethatholdssingle-precisionfloating-pointnumbersinIEEEformat.ASinglevariableisstoredasa32-bit(4-byte)numberranginginvaluefrom-3.402823E38to-1.401298E-45fornegativevalues,from1.401298E-45to3.402823E38forpositivevalues,and0.

Page 635: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

class

Theformaldefinitionofanobject.Theclassactsasthetemplatefromwhichaninstanceofanobjectiscreatedatruntime.Theclassdefinesthepropertiesoftheobjectandthemethodsusedtocontroltheobject'sbehavior.

Page 636: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

parameter

Anelementcontainingavaluethatyoucanchangetoaffecttheresultsofthequery.Forexample,aqueryreturningdataaboutanemployeemighthaveaparameterfortheemployee'sname.YoucanthenuseoneQueryDefobjecttofinddataaboutanyemployeebysettingtheparametertoaspecificnamebeforerunningthequery.

Page 637: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Booleanexpression

AnexpressionthatevaluatestoeitherTrueorFalse.

Page 638: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

BigIntegerdatatype

Adatatypethatstoresasigned,exactnumericvaluewithprecision19(signed)or20(unsigned),scale0(signed:-263≤n≤263-1;unsigned:0≤n≤264-1).

Page 639: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Binarydatatype

Adatatypethatstoresfixed-lengthbinarydata.Themaximumlengthis255bytes.

Page 640: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Chardatatype

Adatatypethatstoresafixed-lengthcharacterstring.ThelengthissetbytheSizeproperty.

Page 641: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Currencydatatype

Adatatypethatisusefulforcalculationsinvolvingmoneyorforfixed-pointcalculationsinwhichaccuracyisextremelyimportant.Thisdatatypeisusedtostorenumberswithupto15digitstotheleftofthedecimalpointand4digitstotheright.BecausetheCurrencydatatypeusesdiscretevaluesforallamounts,binaryround-offisn’tafactorwhencalculatingtotals.

Page 642: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

datesandtimes

Datesandtimesarestoredinternallyasdifferentpartsofarealnumber.

ThevaluetotheleftofthedecimalrepresentsadatebetweenDecember30,1899andDecember30,9999,inclusive.NegativevaluesrepresentdatespriortoDecember30,1899.

Thevaluetotherightofthedecimalrepresentsatimebetween0:00:00and23:59:59,inclusive.Middayisrepresentedby.5.

Page 643: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Decimaldatatype

Adatatypethatstoresasigned,exactnumericvaluewithprecisionpandscales(1≤p≤15;0≤s≤p).

Page 644: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Doubledatatype

Afundamentaldatatypethatholdsdouble-precisionfloating-pointnumbersinIEEEformat.ADoublevariableisstoredasa64-bit(8-byte)numberranginginvaluefrom-1.79769313486231E308to-4.94065645841247E-324fornegativevalues,from4.94065645841247E-324to1.79769313486231E308forpositivevalues,and0.

Page 645: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Floatdatatype

Adatatypethatstoresasigned,approximatenumericvaluewithmantissaprecision15(zeroorabsolutevalue10-308to10308).

Page 646: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Numericdatatype

Adatatypethatstoresasigned,exactnumericvaluewithprecisionpandscales(1≤p≤15;0≤s≤p).

Page 647: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

Timedatatype

Adatatypethatstoresatimevalue.Thevalueisdependentontheclocksettingofthedatasource.

Page 648: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

TimeStampdatatype

AdatatypethatstoresaTimeStamp.Thevalueisdependentontheclocksettingofthedatasource.

Page 649: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

VarBinarydatatype

Adatatypethatstoresvariable-lengthbinarydata.Themaximumlengthis255bytes.

Page 650: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

proceduralquery

AnSQLstatementthatexecutesastoredprocedure.

Page 651: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

unionquery

AnSQL-specificselectquerythatcreatesasnapshot-typeRecordsetobjectcontainingdatafromallspecifiedrecordsintwoormoretableswithanyduplicaterecordsremoved.Toincludetheduplicates,addthekeywordALL.

Forinstance,aunionqueryoftheCustomerstableandtheSupplierstableresultsinasnapshot-typeRecordsetthatcontainsallsuppliersthatarealsocustomers.

Page 652: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

clientbatchcursorlibrary

Alibrarythatprovidesclient-sidecursorsupportforODBCDirectdatabaseapplications.Thislibrarysupportsallfourtypesofcursors(keyset,static,dynamic,andforward-only)andprovidesanumberofotherfeaturesincludingtheabilitytodissociateconnectionsandperformoptimisticbatchupdates.

Page 653: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

validation

Theprocessofcheckingwhetherentereddatameetscertainconditionsorlimitations.

Page 654: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

validationrule

Arulethatsetslimitsorconditionsonwhatcanbeenteredinoneormorefields.ValidationrulescanbesetforaFieldorTableDefobject.Validationrulesarecheckedwhenyouupdatearecordcontainingfieldsrequiringvalidation.Iftheruleisviolated,atrappableerrorresults.

Page 655: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

message

Apacketofinformationpassedfromoneapplicationtoanother.

Page 656: What's New in DAO? · With DAO, you can set the PartialReplica property on a Relation which allows that Relation to be used in partial replication. New Recordset Type In DAO 3.5,

multiuserdatabase

Adatabasethatpermitsmorethanoneusertoaccessandmodifythesamesetofdataatthesametime.Insomecases,theadditional"user"maybeanotherinstanceofyourapplicationoranotherapplicationrunningonyoursystemthataccessesthesamedataassomeotherapplication.