Solved

Can I copy an event procedure form 2003 and add it to 2013 MS Access

Posted on 2015-01-26
5
87 Views
Last Modified: 2015-01-27
I am creating a new db in MS 2013.  Older version is 2003.  Can I copy the code for event procedures into the 2013 and expect it to work accordingly as long as the fields are named the same?
0
Comment
Question by:Angelia1
[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
  • 4
5 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40570671
There is no hard Yes or No here...

In most case code created in 2003 will work fine in 2013.

You may have some reference issue if you do any DAO/DAO stuff, ...or use external controls/ActiveX controls, ...or reference any older Object Libraries....

But for basic VBA code, ...you should be fine.

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40570690
The other kicker here is that it may not be advisable to simply Copy the entire event procedure and paste it into the vba editor, ...like this:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    MsgBox "Hello World"
End Sub

Open in new window

1. You may accidentally pasted it into he wrong object by accident.
When you build vba event code you should always go through the event builder for that object form the property box.
2. When you copy/paste the entire procedure, ...it  may not run until you compile the code, ...

So got through the event for that object and you will get something like this:
Private Sub ID_Click()

End Sub

Open in new window


Then you copy and paste in just the  the "code",...like is:
msgbox "Hello World"

Open in new window


JeffCoachman
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 40570694
so you get this finally:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    MsgBox "Hello World"
End Sub

Open in new window

0
 

Author Closing Comment

by:Angelia1
ID: 40570802
Thank you for your help
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40574392
;-)
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

739 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