Writing Access functions

new2access123

Registered User.
Local time
Today, 03:40
Joined
Feb 5, 2010
Messages
12

I am an old FoxPro programmer (but have been out of programming for many years) and I have been through the Access basics that I have been able to find on line. So I can create tables, forms enter data the basics. I am learning VBA no problem there. Now I want to write some functions. I would like to write one function that is passed an ID and returns the last name of the person having that ID. I would like to write this function in two ways:

1. Connect to a table in my DB find the ID and return the name
2. Have the function perform a query that returns a record set from which the name is returned.

Does any one know where I can find some straight forward simple examples demonstrating this?

This is a training exercise for me to learn how to:
* Connect to tables and process data
* Create a record set and process data from the recordset
* Use debugging techniques breakpoints, run code from the immediate window etc.

I would really appreciate the help

Thanks
 
Since you are wanting to learn Access, you could also use the DLookup() function to do what you want.
 
Thank you for the feed back. It was very informative. I will do some research and be back for more.
 

I am an old FoxPro programmer (but have been out of programming for many years) and I have been through the Access basics that I have been able to find on line. So I can create tables, forms enter data the basics. I am learning VBA no problem there. Now I want to write some functions. I would like to write one function that is passed an ID and returns the last name of the person having that ID. I would like to write this function in two ways:

1. Connect to a table in my DB find the ID and return the name
2. Have the function perform a query that returns a record set from which the name is returned.

Does any one know where I can find some straight forward simple examples demonstrating this?

This is a training exercise for me to learn how to:
* Connect to tables and process data
* Create a record set and process data from the recordset
* Use debugging techniques breakpoints, run code from the immediate window etc.

I would really appreciate the help

Thanks

There are several excellent video tutorials illustrating various Access topics
at http://www.datapigtechnologies.com/

Other useful sites are:
http://allenbrowne.com/tips.html
http://www.fontstuff.com/siteindex.htm#access
http://www.btabdevelopment.com/main/AccessSamples/tabid/54/Default.aspx

Good luck.
 

Users who are viewing this thread

Back
Top Bottom