Solved

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

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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.
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

861 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