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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing a Form's function. 1

Status
Not open for further replies.

Ma3x323

Programmer
Jun 27, 2001
148
0
0
US
Is it possible for one form to access another form's command or event? If so, How?
 
You'll have to move the event to a public module in order to do this.

Joe Miller
joe.miller@flotech.net
 
Geez Joe how do you do that?..

It's no problem to access functions in a form if you make them public.. or is that properties lol! I seem to have around so much with forms that I lose track.. THinking about it you can call functions from properties so ....

what you won't be able to do is to directly respond to an event from many forms... that's one of the things which makes VB suck.. I've got modules with 99% of my forms and I wish I could use generic event servicers..

JOhn


 
So is it possible to call a Form's function from an event ffrom another Form?

Like in C++ where you can just call functions from different Classes using WHATEVER.Function(arguments).

Still a bit confused.

-Feryl
 
OK here is the problem:

# Y/N Stuff Price Qty
1 Gun 345.95 4
2 Rope Hook 34.55 1
3 Good Suit 1000.00 1
4 Keyboard w/ long cord 4.00 1
5 Chair w/ 1 broken leg 5.00 1
6 Assistant 50.00 1
7 Casket 134.50 1

These items are from a table. Let's call it tblItems.
I am going to make another table called tblOrderedItems.
When the Y/N check box is checked, the entire line should go to tblOrderedItems and then updates it and then it goes to the next line. The next checked item should be on the next line. If the check box is unchecked, then that item is going to be taken out of the tblOrderedItems.

Again, I am a beginner to Access and I am just trying to learn how to do stuff.
Thanks to anybody that helps.

Feryl


"If you can't beat them, then have somebody else do it for you."
 
Its a while ago, but maybe still helpful...

1st I assume a form has to be open for any code in there to be called.
2nd Regard the sub/function modifier (Default for Events is Privat Blabla, so this is really private!...)

Right now I design the Code-Behind the form like this:

...

Private Sub Form_Current()
updateDisplay
End Sub

...

Function updateDisplay()
' update stuff
End Function

...

This way I can call a display update from anywhere (as long as the form is open):

Forms("myForm").updateDisplay



Regards
waldemar
 
Ok, it's good what waldemar tolds us, but you can also called the function or sub like this, form_myform.updatedisplay or forms!myform.updatedisplay.

Felix A.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top