Delete Record Invalid Outside Procedure

S

Sheila

When attempting to delete a record I get the following message:


"Invaild Outside Procedure" on (conMESSAGE)


This was based on the below recommendation:
 
K

Klatuu

All VBA executable code has to be enclosed in either a sub or function

Any code here will cause the error

Sub SubName()
Code goes here
End Sub

Any code here will cause the error

Function FuncName()
Code Goes Here
End Function

Any code here will cause the error
 
S

Sheila

Okay...
I've not done this before, so I don't know how to correct the problem.
Thanks for your help.
Sheila
 
K

Ken Sheridan

Sheila:

To enter code in the Delete event procedure select the form in form design
view by clicking on the small grey square at its top left corner and open its
properties sheet if its not already open. Then select the On Delete event
property in the properties sheet. Click on the 'build' button; that's the
one on the right with 3 dots. Select 'Code Builder' in the dialogue, and
click OK. The VBA window will open at the event procedure with the first and
last lines already in place. Enter the lines of code between these two
existing lines.

Do the same for the Before Del Confirm event property, entering the single
line of code there.

BTW its better to stay in the original thread when seeking clarification of
a point rather than starting a new thread. I'd have been notified of your
latest message that way, whereas I could have easily missed it in this thread
( I don't read every one!)

Ken Sheridan
Stafford, England
 
S

Sheila

Thank you, but I wasn't getting any responses, so I tried another way.

Thank you so much for the information. It makes sense now.

Sheila
 
Top