| federicoemer717 ( @ 2011-07-05 15:31:00 |
|
|
|||
|
|
|
|
|
|
|
| Entry tags: | access 2007, code, database, microsoft, microsoft access, ms access, programming, vba |
Microsoft Access - Preserve Programming Time and Price With A Method For Writing Significantly less
You are most likely composing far more Microsoft Entry programming code then you require to. This implies wasted coding time, a lot more code upkeep and achievable debugging. This report applies to all versions of download microsoft access 2007,not just Entry 2007, but many new features of Entry 2007 make it possible for you to do zero coding to do tasks these as bulk emails, sort handle resizing, scheduling tasks, date choosing, formatting, and many others.
I have reviewed tens of 1000's of lines of programmers' code, not just in download microsoft access 2007, and have discovered that numerous lines of code are getting published in spots wherever substantially a lot less code was wanted to do the same task. Here's the approach that will help you save substantially time.
Did you know that your data tables download microsoft access 2007can be employed to control your Accessibility 2007 program and publish code for you, if they incorporate metadata.
Metadata is data about data. You have actually been storing and employing metadata considering that you commenced employing Accessibility 2007. When you pick a colour for a type textbox label, you are instructing Access 2007 to bear in mind this color and operate software code that generates that shade just about every time that label is demonstrated.
Ok, right here is an case in point of how you could preserve on your own from creating several lines of code by working with metadata that you have stored in an Accessibility 2007 info table.
Here's an instance of using metadata. You have some reviews to be printed every Tuesday and some that require to be printed every single Friday. You could create some Entry 2007 code to print the Tuesday reports by producing:
If Weekday(Date) = three then 'It's 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"
Stop if
You would then publish some a lot more code for Friday reviews:
If Weekday(Date) = six then 'It's 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 us write these 14 lines of code with 1 line 7 lines of code.
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Table Title That contains Metadata")
Do Right up until rs.EOF
If ![DayOfWeek] = Weekday(Date) Then
DoCmd.OpenReport ![ReportName]
End If
rs.MoveNext
Loop
These 7 lines of code would not want to be transformed or additional to even if the 10 reports enhance to 50 reports in Entry 2007 or any other version of Accessibility.
The Accessibility 2007 info table would only will need to store the report identify and the day of full week, just two fields of info. This indicates straightforward servicing and no long run code improvements.
This process can be applied for operating a set of queries with a specified sequence. Use metadata when linking to exterior information sources by which include paths, file or table names, and specs. You can automate importing or exporting data by storing import and export specs, formats, and storage paths.
Want additional examples of this time saving strategy? Permit me know. Feedback is always appreciated.