Call procedure?

T588

Registered User.
Local time
Today, 16:20
Joined
Feb 3, 2003
Messages
65
The “Call” procedure is new to me – I’m not sure how to use it – what’s wrong with the following?


I have the following in a module:

Function NewRecord()
DoCmd.GoToRecord , , acNewRec

End Function

*************************************************

And the following in the OnClose of a report……

Private Sub Report_Close()
If IsLoaded("InvoiceList") Then
DoCmd.Close acForm, "InvoiceList"
End If

Call NewRecord
Sub NewRecord()
DoCmd.GoToRecord , , acNewRec

End Sub

I want the report upon closing to close the “InvoiceList” Box and also switch the form to a new record. (all of the other possible “OnClose” are used and I want to learn how to use this “Call” option - it opens up all kinds of opportunities)
Any help would be appreciated

Vince
 
try this


Private Sub Report_Close()

If IsLoaded("InvoiceList") Then
DoCmd.Close acForm, "InvoiceList"
End If

Call NewRecord

End Sub
 
Thanks for replying......But for some reason it doesnt work
I'll have to keep playing with it

Thank again
Vince
 
Thanks - i wont be able to strip it down and post it until tomorrow............

Vince
 
I am assuming that the NewRecord function does not lie within the report's module, but within a different module.

When you call a procedure from a module you must reference the modules name as well as the procedure name.

Call modulename.procedurename(arguments)

HTH
 

Users who are viewing this thread

Back
Top Bottom