Solved

Line out code

Posted on 2013-12-09
7
340 Views
Last Modified: 2013-12-09
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
Comment
Question by:pdvsa
  • 3
  • 2
  • 2
7 Comments
 
LVL 18

Accepted Solution

by:
Jerry Miller earned 150 total points
ID: 39706877
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
 
LVL 18

Expert Comment

by:Jerry Miller
ID: 39706880
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
 
LVL 75
ID: 39706886
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:pdvsa
ID: 39707038
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
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 150 total points
ID: 39707049
Well, nothing  wrong with commenting out the code for your own (or others) historical reasons.
0
 

Author Closing Comment

by:pdvsa
ID: 39707070
thank you.
0
 
LVL 18

Expert Comment

by:Jerry Miller
ID: 39707435
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now