Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function question

Status
Not open for further replies.

nevstic

Instructor
Jul 30, 2002
98
GB
g'morning all
I wonder if anyone could recommend any publication which clearly shows how to make functions, where to put them, and when to use them, how to call them etc.
Even a simple example type book would do.
Or perhaps there are some web pages somewhere.
thanks
Nick
 
Nick,

The first place to look is the help files in Access. They're WAY better in A97 than in any other version, but the newer one should be able to show you something of this.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Hi Jeremy
I wonder if I could prevail upon your knowledge for one question.
If I wanted to put the following code in many controls on multiple forms,I understand that if I could give it a function name and store it in the modules section then it would be available to me,anywhere in the database,

Private Sub AWN_Exit(Cancel As Integer)
If IsNumeric(Me!AWP) Then
If Val(Left(Me!AWN, 7)) Mod 7 = Val(Right(Me!AWN, 1))Then
Me!AWN.ForeColor = 65535
Else 'error in check digit
MsgBox "ERROR ! AWB CHECK DIGIT", 48, "ERROR"
Me!AWN.ForeColor = 255
DoCmd.GoToControl "AWN"
Cancel = True
End If
End If
End Sub

My question is therefore what would I call it and and how would I refer to it on the properties line of a control?

I don't seem to be able to access the 97 help files at the mom.

Many thanks for your patience here.
rgds
Nick


 
Select desired event in your control properties Event tab, press "..." button, choose "Code builder" and you will be suggesteg to put your code in the right place.
 
First, it is not a Function so if you try to use it as a default value it won't work. To allow the code to be placed into a value/event on the properties screen it must be a Function and the syntax would be =AWN_Exit()
Life's a journey enjoy the ride...

jazzz
 
Jazzz has the way to go about it.

Also, this is a small point, but I would _not_ use the ALL CAPS in the message to readers. All Caps is hard to read and is interpretted as shouting. Use a normal case. There's an exclamation option and a critical option to put flags on the message box. These usually work better to get users' attention.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
sorry guys
did'nt mean to shout !
I lost my glasses at the time
Thanks
and rgds
Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top