Solved

Line out code

Posted on 2013-12-09
7
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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 - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create a varying recordset 5 54
GA Ribbon creator 9 64
Speed up Select Top n... Query 9 37
Access - convert query for SQL Server 5 10
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

752 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