Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple, Simple Question

Status
Not open for further replies.

asfhgwt

Technical User
Aug 3, 2006
11
US
How do I call a module from a button on a form? I go to the OnClick poperty, then open "Code Builder," and I see:

-----------------------------------
Private Sub Command399_Click()

End Sub
-------------------------------------

So what the heck goes in the sub to actually run my module (which I've named subNextButton)? I can't seem to find this in my Beginning Programming Guide -- or on the web.

Thanks.

 
I take it your module is name subNextButton and there is code inside that sub?

The code for the Command399_click event would be simply the name of the Procedure you want to run in the module.

Modules in and of themselves are place holders or objects that contain code. Modules are not runnable as objects but the code in them is what you run.


Andy Baldwin

"Testing is the most overlooked programming language on the books!"

Ask a great question, get a great answer. Ask a vague question, get a vague answer.
Find out how to get great answers FAQ219-2884.
 
You mean this?

Private Sub Command399_Click()

subNextRecord

End Sub

It doesn't work. I get an error: "Expected variable or procedure, not module."

Thanks!
 
You should probably post the contents of SubNextRecord. This error indicates that either your sub is not public. Inside your mod this is probably
Private Sub NextRecord

instead of

Public Sub NextRecord


Andy Baldwin

"Testing is the most overlooked programming language on the books!"

Ask a great question, get a great answer. Ask a vague question, get a vague answer.
Find out how to get great answers FAQ219-2884.
 
Does it require you to put this?

Call subNextRecord()
 
Does it require you to put this?

Call subNextRecord()

------------------------

Yes, that worked, and I've figured out my other problems. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top