Solved

Line out code

Posted on 2013-12-09
7
378 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

626 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