Solved

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

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

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

685 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