Above Header LeaderBoard <body> <!--Google Navigation Bar--> <script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener("load", function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <iframe src="http://www.blogger.com/navbar.g?targetBlogID=34083602&amp;blogName=LEARN+MS-ACCESS+TIPS+AND+TRICKS&amp;publishMode=PUBLISH_MODE_FTP&amp;navbarType=BLUE&amp;layoutType=CLASSIC&amp;searchRoot=http%3A%2F%2Fblogsearch.google.com%2F&amp;blogLocale=en_US&amp;homepageUrl=http%3A%2F%2Fwww.msaccesstips.com%2F" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="30px" width="100%" id="navbar-iframe" allowtransparency="true" title="Blogger Navigation and Search"></iframe> <div></div>
Header Right Columns
www.msaccesstips.com

LEARN MS-ACCESS TIPS AND TRICKS

Home

LEARN MS-ACCESS TIPS AND TRICKS

↑ Grab this Headline Animator

Your Ad Here
Wednesday, September 19, 2007

Useful Report Functions

Common Functions that you can use in Report Header or Footer Sections, while designing Reports, are given below. Copy and Paste the VB Code into a Global Module of your database and save it.

Write the Functions in the form of a Formula in Text Boxes as shown in the Syntax.

Function to display formatted Page Numbers.

Function : PageNo()

Syntax : =PageNo([page],[pages])

Result : Page : 1 / XXX where XXX stands for maximum number of pages of the Report.

Note : [page],[pages] are MS-Access built-in Report Variables and must be used as shown.

Code:

Public Function PageNo(ByVal pg As Variant, _
ByVal pgs As Variant) As String
‘----------------------------------------------------------
‘Output : Page: 1/25
‘ : Call from a Report Text Box control
‘Author : a.p.r. pillai
‘Date : 01/09/2007
‘Remarks : The Formatted Text takes up 15 character space
‘----------------------------------------------------------
Dim strPg As String, k As Integer

On Error GoTo PageNo_Err

pg = Nz(pg, 0): pgs = Nz(pgs, 0)
strPg = Format(pg) & "/" & Format(pgs)
k = Len(strPg)

If k < 15 Then
strPg = String(15 - k, "*") & strPg
End If

strPg = "Page: " & strPg

For k = 1 To Len(strPg)
If Mid(strPg, k, 1) = "*" Then Mid(strPg, k, 1) = Chr(32)
Next

PageNo = strPg

PageNo_Exit:
Exit Function

PageNo_Err:
Msgbox Err.Description,, "PageNo()"
PageNo = "Page : "
Resume PageNo_Exit
End Function



Function to print Period with formatted Start-Date and End-Date on Report Header or Footer.

Function : Period()

Syntax : =Period([StartDate], [EndDate])

Result : Period: 15/09/2007 To 30/09/2007

Note: Format String in the Code may be modified for country specific date format.

Code:

Public Function Period(ByVal prdFrm As Date, _
ByVal PrdTo As Date) As String
'-----------------------------------------------------------------
‘Output : Period: dd/mm/yyyy To dd/mm/yyyy
' : Call from Report control to insert date
‘Author : a.p.r. pillai
‘Date : 01/09/2007
‘Remarks : Modify Format String for Country specific date format.
'-----------------------------------------------------------------

On Error GoTo Period_Err

Period = "Period: " & Format(prdFrm, "dd/mm/yyyy") & " To " _
& Format(PrdTo, "dd/mm/yyyy")

Period_Exit:
Exit Function

Period_Err:
MsgBox Err.Description,, "Period()"
Resume Period_Exit
End Function



Function to print formatted System Date in Header or Footer of the Report.

Function : Dated()

Syntax: Dated()

Result : Dated: 15/09/2007

Code:


Public Function Dated() As String
'----------------------------------------------------------------
'Output : Dated: 20/08/2007
' : Call from Report Text Box control
‘Author : a.p.r. pillai
‘Date : 01/09/2007
‘Remarks : Change Format String for Country specific Date Format
'----------------------------------------------------------------
On Error GoTo Dated_Err

Dated = "Date: " & Format(Date, "dd/mm/yyyy")

Dated_Exit:
Exit Function

Dated_Err:
MsgBox Err.Description,, "Dated()"
Resume Dated_Exit
End Function



You can design the full Page Footer of a Report with Date and Page Number at one go with a single Function. Read my earlier Post: Reports – Page Border. Use the Function DrawPageFooter() Code & procedure explained there.

You can add frequently used Expressions or Routines as Public Functions into a Global Module of your Database and Run from where you need them (Forms, Reports, Query Expressions etc.) rather than repeating the code everywhere.

You can further enhance the use of all the common Functions that you have, by organizing them into a separate Database and link this as a Library File into your New Projects. In this case, if you have any common Form (like MS-Access Form Wizard) that you have designed then that also can be placed in the Library Database. When you call the Library Function from your Project, which uses the common Form, MS-Access first checks for the Form in the Library Database, if not found there then opens it from your current Project.

Follow the procedure explained in the earlier Post Command Button Animation for linking the Essential Library Files to your Project. Your Library Database’s name may not appear in the installed library file’s list. Browse to the location of the database, attach it to the library list and select it.
You can save this Library file into a compiled state by converting it into a .MDE File. Select Tools --> Database Utilities --> Make MDE File to convert and save the current database into .MDE Format. You cannot edit the code in the .MDE database. Preserve the .MDB file for future changes and compilation, if it becomes necessary.

When you install your Project don’t forget to install your common Library Database also along with it and attach it to your Project in the new location. That rule goes for other built-in Library Files also in the new location. It is likely that the built-in Library File Versions are different on the new machine, from what you have used at design time. This can happen if other Visual Basic based Applications are already installed earlier in the target machine. Such items will show as MISSING in the selected Library Files' List and you must attach the available Version of the file on the installed location.

If your Project is shared by different Versions of MS-Office Applications, then it is a good idea to attach an older version of the built-in library file (if available) to the project.

Refer the earlier Post on Sharing an Older Version Database under the topic: Ms-Access Security.


Reminder PopUps
MS-Access Graph Charts
MS-Access Graph Charts-2
Report Page Border
Highlighting Reports

Labels:

1 Comments:

Blogger Bandhan Computer Systems said…

You are the Boss and you are the GURU. Thank you very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very and Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay Many many mnay so much.

Because its the your achievement.

Thank you again

Best Regards
Shamim Uddin
Chittagong, Bangladesh
bd.joher@gmail.com

July 01, 2008 12:36 PM  

Post a Comment

Note:Comments subject to Review by Blog Author before displaying.

Links to this post:

Create a Link

<< Home

Page Footer

Creative Commons License
Learn MS-Access Tips and Tricks by msaccesstips.com is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 India License.



This Page is best viewed with 1280 x 1024 Resolution

Sidebar Left
   FEATURED LINKS
SITEMAP
Command Button Animation
3D Headings on Forms
MsgBox & Office Assistant
Reminder Ticker
MS-Access & E-Mails
Automated E-Mail Alerts
MsgBox with Options Menu
Colorful Command Buttons
Configure Lotus Notes
Alerts through Network
Running this site has become a costly affair as the revenue from Ads is not sufficient to support it. If you find these pages informative & useful and would like to extend a helping hand, then please do it here.





Link Back to us with this Button

Learn MS-Access

Copy and Paste this HTML Code in your Webpage


Add to Technorati Favorites

Programming Blogs - Blog Catalog Blog Directory
Powered by FeedBurner
Add to Google

Software
Computers blogs
TopOfBlogs



AddMe - Search Engine Optimization Submit Your Site Free!
Go BlogZ Ave Blogs
eBlogzilla Changing LINKS
LS Blogs Blogarama
blog search directory BlogUniverse
Find Blogs in Directory RSS Directory
blogskinny.com ShowcaseBlogs.com
Amfibi

Search Engine Optimization and SEO Tools
Dmegs Web Directory Takeaway for Sale Businesses For Sale
Free Submission Directory Free site submission

Free Listing
 

Sidebar Right Top



Free Page Rank Checker

AddThis Social Bookmark Button

Enter your email address:

Delivered by FeedBurner



Top Blogs

Microsoft Access is the Jewell among MS-Office suite of Applications. Its Security features are excellent and works fine in Network environment. MS-Access can link/upload data from any Data Source. Applications that you design should be user-friendly and visually pleasing too. Here I would like to share my experience in Microsoft Access Programming with you and I am sure that you will find them interesting too.

My Photo
Name: Ramachandran Pillai
Location: Ruwi, Oman


If you need a Demo of any of the Topic explained here, send me an E-mail to: aprpillai@msaccesstips.com
with the Topic Description, I shall try to send a sample database to you.


Sidebar Right Top

Access Tips | Email | Reports | Report Tricks | Graphs | Forms | Menus | Animation | Security | Internet | How TOs | Linking | Query | Progress Meter | Alerts | Process Tips | Access Functions |





Site Designed by:www.msaccesstips.com