Solved

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

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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

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…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

705 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