function

deekras

Registered User.
Local time
Today, 11:26
Joined
Jun 14, 2000
Messages
169
i should know this, but ...

i have some coding that is used as the afterupdate for many fields on my report. i know i should make a public function for it and then call it as necessary. but it doesn't seem to work the way i did it.

( i know the coding is fine)
what should i be doing? how do i call it?
 
In the After_Update of the Control, enter the function name

IMO
 
i don't have to pass any info or anything. it is just coding to gather a few fields to make a comprehensible note in a new field. (the user then clicks a button if she likes the note, otherwise she can make changes.)
 
Code:
Public Function notes() 

If Not IsNull(Me.Combo70) Then 
    Me.AMnewnotes = "nature of call: " & Me.call_reason & ". action taken: " & Me.action_taken & ". member's reaction: " & Me.comment 
Else
    If Not IsNull(Me.save_reason) Then 
        Me.AMnewnotes = "nature of call: " & Me.call_reason & " because " & Me.[wants term reason] & ". action taken: " & Me.action_taken & ". I was able to save this member by " & Me.save_reason & ". member's reaction: " & Me.[member reaction] & ". " & Me.comment 
    End If
End If

End Function

Here's your function.

Change it to a sub as it doesn't return a value.

It should now be:

Code:
Public Sub notes() 

If Not IsNull(Me.Combo70) Then 
    Me.AMnewnotes = "nature of call: " & Me.call_reason & ". action taken: " & Me.action_taken & ". member's reaction: " & Me.comment 
Else
    If Not IsNull(Me.save_reason) Then 
        Me.AMnewnotes = "nature of call: " & Me.call_reason & " because " & Me.[wants term reason] & ". action taken: " & Me.action_taken & ". I was able to save this member by " & Me.save_reason & ". member's reaction: " & Me.[member reaction] & ". " & Me.comment 
    End If
End If

End Sub

Have you put it in a stand-alone module? If so, you can't use Me.

If it's on your form, you just call it in the AfterUpdate event by saying:

Code:
Call notes
 
it works now. the name of my function must have been a reserved word.
 

Users who are viewing this thread

Back
Top Bottom