Sunday, July 8, 2012

Custom Microsoft Access Functions: How To Borrow Functions From The Microsoft Excel Library


The definition of each function regardless of the application the ability to calculate and process variables or pass the value to return a single value (response).

All you do is simply call the function (by name) and set some parameters (some are optional) and let the system detect a response by return. Where it is used within Microsoft Access can be one of many places, including tables, queries, forms and reports.

Custom Access database functions will be the beneficiary or writing VBA code to compile other routines and predefined functions Access used to measure the function of these objects. Another way to build a custom function is simply borrowed from other applications (if any), rather than re-invent the wheel!

Simple Steps to build the Access database function

Well, here's how to do it just to show you the following simple steps to borrow another function in this case from Microsoft Excel.

Well, here's how to do it just to show you the following simple steps to borrow another function in this case from Microsoft Excel.

...

Well, here's how to do it just to show you the following simple steps to borrow another function in this case from Microsoft Excel.

...

Well, here's how to do it just to show you the following simple steps to borrow another function in this case from Microsoft Excel.

...

3 Add the following VBA code:

Public function properly (field as String) As String 

Dim XLF As Excel.WorksheetFunction

Set XLF Excel.WorksheetFunction =

= Proper xlf.Proper (field)

End Function

4 Save your changes and you're good to go.

Now in the query, you can call this function which will be specified in the Expression Builder tool as the database name in the module (eg Module1 if they remain unnamed).

When you wrap around the proper function of the field, and PROPER ( [CompanyName] ) , it will be converted words in capitalized initial letters.

Custom Microsoft Access functions are easy to build and use. See other Excel functions can serve you well.

No comments:

Post a Comment