954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Pass Controls of Access-Form to sub in module

I'm working on a MS-SQL-Server-DB with MS-Access.
There are some dozens of forms.
I'd like to translate the forms by button-click into another language.
I've made a procedure (sub) called by button-click which walks over the complete "Controls" and changes the captions.
So far, so good.
But this procedure (in a test-form) will become more and more complex and so I would like to declare this procedure outside of the forms for easier maintainance (it's not very comfortable to change the code in dozens of forms for each new feature/bug-correction).
So I declared a new module (not class-module) and inserted the procedure in the module. But I have to pass the list of controls (in the form simply referenced by "Controls" or "Me.Controls") to this procedure. But now the moment has come when I started asking friends and googling, as the pass didn't work.
I've tried many versions, but there was always an error:
mostly "Error while compiling: Argument not optional" (I hope you know what I mean because I'm from Austria and I'm working with German Version of Access)
Maybe I've overseen something because I've started with access a few months ago but I'm a programmer nearly 20 years now (pascal, modula-II, fortran, java, javascript, php, ...)

in the Form:

'Click at button
Private Sub Befehl18_Click()
   TestTranslate.ChangeControls (Me.Controls)
End Sub

in the module:

Sub ChangeControls(pControls As Controls)
...
End Sub


I hope this is clear enough for some of you to help me

ChriRi
Newbie Poster
3 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

If there is a solution with a kind of include-file (like in c) I'd be glad about, too.

ChriRi
Newbie Poster
3 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

SOLVED

I've got the solution. It was a beginners mistake.
Although I've already written many, many procedures and procedure-calls that worked fine
I typed a syntax-error in this situation (in reminiscence of pascal maybe).
the call of the procedure should be:

TestTranslate.ChangeControls Me.Controls

(without the parentheses)
now it works fine.

I'm very sorry for bothering you with such a mess :(

ChriRi
Newbie Poster
3 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You