how to pass form name to a module?

J

Jon

Greeting,
I want to display the current form name when clicke on a button in the form,
but I want to use a module for that? any help please!!!
 
J

Jeff Boyce

Jon

Something like (untested):

YourFunction(strName as String)
...


and to call it from within a form, on a button click, you could use:

Call YourFunction(Me.Name)

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
D

Dorian

Call the function in your OnClick event.
Pass the form name as a parameter to your procedure or function.
Call DisplayFormName("formname")
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
J

Jon

Thank you all,
but could you please provide full code? also, I want to to display the form
name in msgbox please?
 
A

Alexander Achenbach

Public Function MyFunction()
On Error Resume Next
MsgBox Screen.ActiveForm.Name
On Error Goto 0
MyFunction=0
End Function
 
J

Jeff Boyce

It appears Alexander has provided this.

I'm curious why you've not posted the code you've already tried.

Are we creating this for you, something like a homework assignment, or
helping you create it?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top