Function help and example

A

a

Dear All

My question is:

(1) I want get real access 2003 function example.

(2) I want pass argument to the function using text box or input box.

(3) Can you please write this example for me: so I can understand the
argument and the function return value

Example:

Public Myfunction (argument here) as data type

- Pass Number to the function>>>Function give me(return) text

- Pass Number to the function>>> Function give me (return) date

- Pass text to the function >>> Function give me (return) Number

- Pass Text to the function >>> Function give me (return) Date

- Pass Date to the function >>> Function give me (return) Number

- Pass Date to the function >>> Function give me (return) text

Please give me an easy example :
 
J

Jeanette Cunningham

Here is a function example.
This a simple function that takes a text string and adds 2 A's to the end

Private Function AddTwoA(TextIn as String) As String
Dim strSample as String
strSample = TextIn & "AA"
AddTwoA = strSample
End Function


To use the function:
On your form put a text box named txtTheTest
Code its after update event like this:

Private Sub txtTheTest_AfterUpdate()
Me.txtTheTest= AddTwoA(TextIn:=Me.txtTheTest)
End Sub

You pass the value of the control called txtTheTest to the function at the
end of this line in between the asterisks**
Me.txtTheTest= AddTwoA(TextIn:=*Me.txtTheTest*)
You get the return value showing in the control after the control's after
update event runs.

Open the form and type something in txtTheTest
Press tab
You will see the return value of the function in txtTheTest

The above is an example for a text field

Jeanette Cunningham
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top