Audit Trail Follow Up

D

DDrowe

OK, problem with it. It worked great for the first form but I am getting a
lot of errors on the second form I am trying to add. Below is the error that
I have not been able to work out. Any help would be greatly appreciated.

"Compile Error:
Method or Data member Not Found"

For the following:

"Private Sub Form_BeforeUpdate(Cancel As Integer)
bWasNewRecord = Me.NewRecord
Call AuditEditBegin("PSSR", "audTmpPSSR", "NumberA", Nz(Me.NumberA, 0),
bWasNewRecord)
End Sub"
 
W

Wayne Morgan

A compile error is usually a typo. Where is the fuction you're calling
(AuditEditBegin) located? Is it in a standard module or the other form's
module? If you're going to call it from several forms, it should be in a
standard module and declared as Public, not Private. Along with the
parameters you're currently passing, you may also need to pass the name of
the form (depending on what you have the function doing) so that it knows
which form called it.
 
D

Douglas J. Steele

Where does AuditEditBegin exist: in a stand-alone module, or in the module
associated with an existing form?

It's far easier putting it into a stand-alone module than trying to call it
from another form's module. (for one thing, the other form must be open to
use its code)
 
D

DDrowe

Each form has its own Call routines to a master Module that contains the
routines; the AuditEditBegin for example. I replyed with a copy of the code
under the form on my other post if you want to take a look at it. I think
that each of the forms is supposed to have code that references the single
Module.

Does that make sence?

Thanks

David
 
W

Wayne Morgan

You don't make the module public, you make the procedure public. A standard
module is a module you create in the modules window of the main database
window. The name of the module cannot be the same as the name of any other
procedure, including the names of procedures (subs and functions) in that
module. The easiest way around this is usually to name the module starting
with bas, such as basMyFunctions.

To make the procedure public, follow the instructions in the last message.
The first line of your procedure is probably something like

Private Function AuditEditBegin(your parameters here)

To make it public:

Public Function AuditEditBegin(your parameters here)

You can put multiple procedures in each module.
 

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