Solved

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

Posted on 2015-01-26
5
83 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
  • 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

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
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…
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…

943 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

15 Experts available now in Live!

Get 1:1 Help Now