Link to home
Start Free TrialLog in
Avatar of wendeenelson
wendeenelsonFlag for United States of America

asked on

Calling a function in another form

I have a database GUI that I am building for order entry.  There are 3 main screens.  

Customer SWX: F(x) >> Search for customers, create customers, view their details, and start an order.
Order SWX: F(x) >>  List the order history of the customer that was selected, create a new order, edit an order, or remove an order.
Create Order:  F(x) >> Select the items to be ordered, the quantity, and save to the order table.

All of that works fine.  But what I want is the ability to finalize the order.  This will sum the order total and save the total in my order table.  That works too.  However, I cannot get it to update the Order SWX list box of orders by the selected customers.

I am loading the rowsource via VBA, not a Table/Query within the form.  How do I requery that listbox on the Order SWX screen from the Create Order screen?
Avatar of Angelp1ay
Angelp1ay
Flag of United Kingdom of Great Britain and Northern Ireland image

You could put the function into a module (which is global) and then (provided its public) you can call it from any form.

I'm sure there must be a way to do something like this too:

    Application.Forms("formname").FunctionName(blah)

...but I haven't worked it out yet!
Avatar of wendeenelson

ASKER

That is what I had in mind to.  But I don't know how to make it work.
That did not work.
I just tried this and it works:

    Call Forms("form2").moveBox

code in form1!!!
ASKER CERTIFIED SOLUTION
Avatar of Angelp1ay
Angelp1ay
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That works!!!

Thank you thank you!!