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?
wendeenelsonAsked:
Who is Participating?
 
Angelp1ayCommented:
Full code:

Form1
**************************
Option Compare Database

Private Sub Command0_Click()
    ' Run function on form 2!!!
    Call Forms("form2").moveBox
End Sub

Form2
**************************
Option Compare Database

Public Sub moveBox()
    Call Me.Box0.Move(1, 1)
End Sub



Hope that helps :o)
0
 
Angelp1ayCommented:
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!
0
 
wendeenelsonAuthor Commented:
That is what I had in mind to.  But I don't know how to make it work.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
wendeenelsonAuthor Commented:
That did not work.
0
 
Angelp1ayCommented:
I just tried this and it works:

    Call Forms("form2").moveBox

code in form1!!!
0
 
wendeenelsonAuthor Commented:
That works!!!

Thank you thank you!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.