INDEXER

[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.

[ad_2]

AUTOPOST by BEDEWY VISIT GAHZLY

About Author

Leave a Reply

Leave a Reply