[ad_1]
You might be in all probability writing extra Microsoft Entry programming code then itâs essential. This implies wasted coding time, extra code upkeep and doable debugging. This text applies to all variations of Microsoft Entry, not simply Entry 2007, however many new options of Entry 2007 assist you to do zero coding to do duties resembling bulk emails, kind management resizing, scheduling duties, date selecting, formatting, and so forth.
Iâve reviewed tens of hundreds of traces of programmersâ code, not simply in Entry 2007, and have discovered that many traces of code are being written in areas the place a lot much less code was wanted to do the identical job. This is the method that may save a lot time.
Do you know that your information tables in Microsoft Entry 2007 can be utilized to regulate your Entry 2007 program and write code for you, in the event that they comprise metadata.
Metadata is information about information. Youâve gotten truly been storing and utilizing metadata because you began utilizing Entry 2007. If you select a coloration for a kind textbox label, youâre instructing Entry 2007 to recollect this coloration and run program code that creates that coloration every time that label is proven.
Okay, right here is an instance of how you would save your self from writing many traces of code through the use of metadata that youâve got saved in an Entry 2007 information desk.
This is an instance of utilizing metadata. Youâve gotten some reviews to be printed each Tuesday and a few that have to be printed each Friday. You possibly can write some Entry 2007 code to print the Tuesday reviews by writing:
If Weekday(Date) = 3 then âIt is Tuesday
DoCmd.OpenReport âTuesday Report Aâ
DoCmd.OpenReport âTuesday Report Bâ
DoCmd.OpenReport âTuesday Report Câ
DoCmd.OpenReport âTuesday Report Dâ
DoCmd.OpenReport âTuesday Report Eâ
Finish if
Youâd then write some extra code for Friday reviews:
If Weekday(Date) = 6 then âIt is Friday
DoCmd.OpenReport âTuesday Report Aâ
DoCmd.OpenReport âTuesday Report Bâ
DoCmd.OpenReport âTuesday Report Câ
DoCmd.OpenReport âTuesday Report Dâ
DoCmd.OpenReport âTuesday Report Eâ
Finish if
Now letâs write these 14 traces of code with one line 7 traces of code.
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset(âTable Name Containing Metadataâ)
Do Till rs.EOF
If ![DayOfWeek] = Weekday(Date) Then
DoCmd.OpenReport ![ReportName]
Finish If
rs.MoveNext
Loop
These 7 traces of code wouldnât have to be modified or added to even when the ten reviews improve to 50 reviews in Entry 2007 or another model of Entry.
The Entry 2007 information desk would solely must retailer the report identify and the day of week, simply two fields of knowledge. This implies straightforward upkeep and no future code modifications.
This system can be utilized for operating a set of queries with a specified sequence. Use metadata when linking to exterior information sources by together with paths, file or desk names, and specs. You may automate importing or exporting information by storing import and export specs, codecs, and storage paths.
Need extra examples of this time saving strategy? Let me know. Suggestions is all the time appreciated.
Leave a Reply