944,044 Members | Top Members by Rank

Ad:
Mar 13th, 2006
0

Pass Controls of Access-Form to sub in module

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ChriRi is offline Offline
3 posts
since Mar 2006
Mar 13th, 2006
0

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

If there is a solution with a kind of include-file (like in c) I'd be glad about, too.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ChriRi is offline Offline
3 posts
since Mar 2006
Mar 13th, 2006
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ChriRi is offline Offline
3 posts
since Mar 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: VB6 and MSAccess
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Compiling VB6 crash - now with more information





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC