Tải bản đầy đủ - 0 (trang)
Hack 5. Transfer Data Between Versions of Access

Hack 5. Transfer Data Between Versions of Access

Tải bản đầy đủ - 0trang

Admittedly,exportingandimportingtextisn'tanideal

approach,especiallywhenyouhavetoexportorimportmany

tablesofdata.Butitsurebeatslosingbusinessbecauseyour

clientcan'topenyourdatabase.

XMLhaspavedthewayforeasydataexchangeamongversions

andsystems.XMLsupportisdecentenoughinAccess2003,

lesssoinAccess2002andAccess2000.Ifworkingwithtext

filesjustdoesn'tseemrightforyourneeds,youcanalwaysuse

XML.AseparateexternalXMLparserdoesthetrick.



1.6.1.SeeAlso

"ProvideCompleteXMLControltoAnyVersionofAccess"



[Hack#87]

"UseAccessasanXMLDatabase"[Hack#95]



Hack6.OrganizeandEnhanceYourMacros



Optimizeandreducethenumberofmacrosusingthe

optionalnameandconditioncolumns.

Macrosareoftenusedforsmallautomationsusuallyfortasks

thataren'ttoocomplexorsophisticatedbecauseVBAis

availabletohandletheheavyprocessing.Let'sthinkthatway

nomore.Actually,macroscanhandleadecentamountof

intelligentprocessingand,infact,haveacondition-testing

abilitysimilartotheIf…ThenstructureinVBA.Thishackshows

youhowtotransformasinglemacrointoamultipurpose

workhorse.



1.7.1.ConditionalMacroActions

Macroshavebutasinglemandatorycolumn:theAction

column.Amacrocanhaveoneormoreactions.However,

macrosalsohaveanoptionalConditioncolumn,inwhichalittle

entrycangoalongwaytowardaddingsomepunchtothe

process.Whenyou'redesigningamacro,usetheViewmenuto

displaytheConditioncolumn.

Aconditioncantestafieldvalue,evaluatetheresultreturned

byafunction,andevenusethereturnedvaluefromamessage

box.ConditionsalsocanuseBooleanlogic,incorporating

and/or-typelogicintheconditiontesting.

Figure1-13showsamacroinwhichaseriesofactionsoccur

whenthemacroisrun.Afewoftheactionsrunonlywhentheir

conditionismet.Forinstance,theEndofMonthfunctionandthe

EndofMonthreportareincludedintheprocessingonlywhenit



isthefirstdayofthemonth(presumablytallyingupfigures

aboutthemonththatjustended).UsingtheDayandNow

functionstakescareoftestingforthefirstdayofthemonth.

TheEmployeeBonusreportrunsonlywhenaconditiontested

withaDLookupfunctionisTRue.

Theunconditionalactionsinthemacroalwaysrun.Evenwhen

theactionswithunmetconditionsarepassedover,themacro

continuestorunanddoesn'tstopprematurely.



1.7.2.CreatingMacroGroups

Macroscanalsobeorganizedintogroups,knownasmacro

groups.Bycreatingmacrogroups,youcanreducethenumber

ofoverallmacrosandkeepsimilarmacroactionstogetherin

oneplace.Thekeydifferencebetweenamacroandamacro

groupistheuseoftheoptionalMacroNamecolumn.

Whenyou'redesigningmacros,usetheViewmenutodisplay

theMacroNamecolumn.Figure1-14showsamacrogroup

namedRunReport.Themacrogrouphandlesthetaskofopeninga

numberofindividualreports.Animportantpoint,though,is

thatthesereportswon'topenatthesametime.Eachmacro

nameexistsasaseparatemacrowithinthelargergroup.



Figure1-13.Usingconditionsinamacro



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Hack 5. Transfer Data Between Versions of Access

Tải bản đầy đủ ngay(0 tr)

×