Accessing a module

Nenya

Registered User.
Local time
Today, 18:39
Joined
Jul 4, 2003
Messages
20
Hello

I have a public sub in a module. I want to access this sub from a button on a form.

When i click on the button, it calls a sub (from the event). This sub should be able to call the public sub from the other module, but i can't manage to do it.

Thx to anyone who can help:)
 
To call the public sub

Code:
Sub CommandButton_OnClick()
your other code
[b]call YourPublicSub(Arguments)[/b]
 
Hmm, i tried that before posting...
My sub is not recognized...
(and i checked for spelling also)
 
Post the code behind the button click.
 
There is my function:

Private Sub SuivantActAPrec_Click()
Call ActAPrec("hey1", "haha2", "hehe3", "hoho4", False)
DoCmd.OpenForm "FrmPrecAct"
If CadreActivite.Value = 2 Then
Form_FrmPrecAct.ModPrecAct.Visible = False
Form_FrmPrecAct.Option3.Visible = False
Form_FrmPrecAct.Option5.Visible = False
End If
End Sub

The arguments are just for testing purpose for now.
The sub ActAPrec is from a module, but it's not found by access.
 
And it is declared as a public sub?

Public Sub ActAPrec(a,b,c,d,e)
 
This is my public function prototype :

Public Sub ActAPrec(ByVal noBloc As String, ByVal noAct As String, ByVal defAct As String, ByVal lstAct As String, ByVal existante As Boolean)

:(

Also, when i call the public sub from the button sub, the caps are changed properly... When i tried to run it, it fails with the following message :

"Undefined Sub or Function"

:( :(
 
Last edited:
Has the module been saved?
Can you post your module? - I cannot understand why your method does not work??
 
Fizzio said:
I cannot understand why your method does not work??

Me too:eek:

Public Sub ActAPrec(ByVal noBloc As String, ByVal noAct As String, ByVal defAct As String, ByVal lstAct As String, ByVal existante As Boolean)
Let BLOC = noBloc
If existante = True Then
Let ACT.No = lstAct
Let ACT.Description = "empty"
Else
Let ACT.No = noAct
Let ACT.Description = defAct
End If
End Sub

I saved the module a couple of time, restarted access a couple of time, and now, i'm thinking of rebooting my system, or throw it by the window...

I also try a testing function but it doesn't work more than the first one :

Public Sub HAHAHA()
Beep
End Sub

If you can see what's wrong... you're good!
 
The module name is : ClasseCreation

The error message is : "Undefined Sub or Function"

Error occurs while running the button code.


Edit: i found out what was wrong...I apparently use the wrong module type (have no idea how that happened). :o

It working now. Thanx for the help anyway
 
Last edited:

Users who are viewing this thread

Back
Top Bottom