[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Calling a function in another form

Posted on 2007-10-12
6
Medium Priority
?
2,446 Views
Last Modified: 2013-11-28
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?
0
Comment
Question by:wendeenelson
  • 3
  • 3
6 Comments
 
LVL 11

Expert Comment

by:Angelp1ay
ID: 20065649
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
 

Author Comment

by:wendeenelson
ID: 20065749
That is what I had in mind to.  But I don't know how to make it work.
0
 

Author Comment

by:wendeenelson
ID: 20066450
That did not work.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 11

Expert Comment

by:Angelp1ay
ID: 20066504
I just tried this and it works:

    Call Forms("form2").moveBox

code in form1!!!
0
 
LVL 11

Accepted Solution

by:
Angelp1ay earned 2000 total points
ID: 20066510
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
 

Author Comment

by:wendeenelson
ID: 20066705
That works!!!

Thank you thank you!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question