By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 1,950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

Linking modules to buttons in forms. How????

P: n/a
Hi,

I am working on an application in Access 97. I want to run an module
from an form but I can't find how to link the saved module to the
button. I can link a macro to this button by selecting the macro on
the Command button property "OnClick". But a module????

What might work is making an eventprocedure at the OnClick-property of
the commandbutton ("Command_5") by clicking on "...". You get this:

<quote>
Private Sub Command5_Click()

nResult = MsgBox("Dit is een test", vbOKOnly)

End Sub
</quote>

But it gives an error at the first line.

Greetings from a desperate access-user.
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
As long as the VB is similar to Access 2000 . . .

If the code in the module is a (public) function, just set the button's
on-click event to call the function.

Private Sub Command5_Click()

Call MyPublicFinctionInModule(<whateverParams>)

End Sub
</quote>

Nov 13 '05 #2

P: n/a
you may have to qualify the function with the module name at the
beginning i.e. ModuleName.FunctionName()

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.