How to run a function in a subroutine

born2live

Registered User.
Local time
Today, 22:33
Joined
Jul 19, 2012
Messages
26
How to run a function in a subroutine?

Hi guys,
I have a database which needs to be updated everyday. So I decided to make a subroutine to perform the update steps just by clicking on a button. :)
The problem is that I can run all the steps except one!:banghead: At the end of the steps, there is a function/module that must be run to calculate and complete the job.

Please tell me how I can run a function in a vba macro.
This is my code:

Private Sub cmdUpdateDatabase_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry1AddNewStockSymbols"
DoCmd.OpenQuery "qry2AddDailyPrice"
DoCmd.OpenQuery "qry3UpdateStockDailyPrice"
DoCmd.OpenQuery "qry4AddOverallStockValue"
DoCmd.OpenQuery "qry5AllSymbolsActiveDaysTractions"
DoCmd.OpenQuery "qry6SortToCalculateDailyRemainedStock"
DoCmd.SetWarnings True
End Sub

Module name is: CalculateDailyRemainedStock
Thanks in advance for any helps.
 
Last edited:
Thanks a lot pbaldy.
I found my mistake in that link you mentioned ===> the name of module and the function were the same. After changing one of the names, with Call FunctionName it worked. :)
 
Happy to help and welcome to the site by the way!
 

Users who are viewing this thread

Back
Top Bottom