Thanks, we are two programmers working on a database and I can use his code, but I would prefer not to modify it in any way.
Main Topics
Browse All TopicsIs it possible to call a private sub let's say 'mysub' on 'myform' from another form 'myotherform'?
The call statement would look something like: myform.mysub in the code for 'myotherform'
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
To be strictly technical, the answer to your question in No, you cannot call a Private sub/function outside the scope of that function.
However, simply removing the Private from the "Private Sub" line would make this available to the rest of your project (you don't have to change the Sub to a Function) and would have no impact on the other devs code. However, I'd strongly suggest you consult with the other dev to insure that actually running the code would have no impact outside the form (i.e. it doesn't delete records, update records etc).
If it is a gereic code used by multiple users (as you have stated that you want to use his code), then it should be a library function instead of private function or private sub.
Talk with other developer, and create a module in Access. Copy the function or sub to the module and remove private keyword. Use the same function or sub in your form.
That should work.
Business Accounts
Answer for Membership
by: TOPIOPosted on 2008-02-18 at 09:46:59ID: 20921912
I would instead change the private sub to a Function that can be called from anywhere in your code
original code
Private Sub myform_mysub()
Function mysub()