Pass Controls of Access-Form to sub in module

Thread Solved

Join Date: Mar 2006
Posts: 3
Reputation: ChriRi is an unknown quantity at this point 
Solved Threads: 0
ChriRi ChriRi is offline Offline
Newbie Poster

Pass Controls of Access-Form to sub in module

 
0
  #1
Mar 13th, 2006
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:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 'Click at button
  2. Private Sub Befehl18_Click()
  3. TestTranslate.ChangeControls (Me.Controls)
  4. End Sub
in the module:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Sub ChangeControls(pControls As Controls)
  2. ...
  3. End Sub

I hope this is clear enough for some of you to help me
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 3
Reputation: ChriRi is an unknown quantity at this point 
Solved Threads: 0
ChriRi ChriRi is offline Offline
Newbie Poster

Re: Pass Controls of Access-Form to sub in module

 
0
  #2
Mar 13th, 2006
If there is a solution with a kind of include-file (like in c) I'd be glad about, too.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 3
Reputation: ChriRi is an unknown quantity at this point 
Solved Threads: 0
ChriRi ChriRi is offline Offline
Newbie Poster

Re: SOLVED: Pass Controls of Access-Form to sub in module

 
0
  #3
Mar 13th, 2006
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:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. TestTranslate.ChangeControls Me.Controls
(without the parentheses)
now it works fine.

I'm very sorry for bothering you with such a mess
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC