• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • Last Modified:

Line out code

Is it advisable to also line out the event and End sub thereby completely removing any event?  Not sure if there could be a conflict if Access "sees" an event but there is nothing to execute.  

Private Sub Form_BeforeUpdate(Cancel As Integer)
'codes here
End Sub

is it advisable to do this: (rem out Private and End Sub)
'Private Sub Form_BeforeUpdate(Cancel As Integer)
'codes here
'End Sub
0
pdvsa
Asked:
pdvsa
  • 3
  • 2
  • 2
2 Solutions
 
Jerry MillerCommented:
I will usually comment the code inside the event rather than entire event, but they both will do basically the same thing. The only difference that I can think of is you will generate errors if something else is calling the event and you have it commented (lined out).
0
 
Jerry MillerCommented:
If the event is not commented, Access will see the event and run it at the appropriate time but nothing will happen since there is no code to execute.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Unless you have [Event Procedure] on the Property sheet of a Form or Control on the Form, no code will execute.  If you are no longer using the event, then delete the code. Less Is More.

mx
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
pdvsaProject financeAuthor Commented:
I only thought to keep the event and comment out the code to show that I did try to do whatever it was and decided it was not the way to go and had no other additional code there.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Well, nothing  wrong with commenting out the code for your own (or others) historical reasons.
0
 
pdvsaProject financeAuthor Commented:
thank you.
0
 
Jerry MillerCommented:
I do that sometimes. Leave attempted solutions commented out with notes as to why it didn't work. I usually remove all of that in the production copy though. I maintain two copies of everything; one that is a direct copy of the working production code and another that has all of my development 'stuff'.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now