473,396 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

calling is not working

Hello I am not an experienced programmer.
I need to call a sub from module 1 to module 2
I am using bellow mentioned code to do so but its not working please help me to get this thing solved.

Sub testhide()
Call Module1.AdminHide
End Sub
Nov 25 '08 #1
3 1104
Dököll
2,364 Expert 2GB
I'll add a bit also for you, see if you can salvage for parts...

Module code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Public form2 As String
  3.  
  4. Public Sub frame()
  5.  
  6. 'you need two options buttons a frame
  7. If Option1 Is Selected Then
  8.         form2.Frame2 = small
  9.  
  10.     ElseIf Option2 Is Selected Then
  11.         form2.Frame3 = medium
  12.     Else
  13.         MsgBox ("what happened?")
  14.     End If
  15.  
  16. End Sub
  17.  
Form 1 code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'this is used as a splash screen
  3. please ignore this form, you can just use form 2 code
  4. Private Sub Continue_button_Click()
  5. Form1.Visible = False
  6. form2.Visible = True
  7.  
  8. End Sub
  9.  
Form 2 code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Command1_Click()
  3.  
  4. 'we are assigning media a number to be used later
  5. If Option1 = True Then
  6.     media = 1
  7. ElseIf Option2 = True Then
  8.     media = 2
  9. End If
  10.  
  11. 'if media equals 1 a certain frame pops up with additional field data..
  12. 'frames are layered depending on which option is pressed
  13. If media = 1 Then
  14.     Frame2.Visible = True
  15.     Frame3.Visible = False
  16. 'media 2 can represent, in my case video frame
  17. 'media 1 can represent DVD frame, data on frame
  18. ElseIf media = 2 Then
  19.     Frame2.Visible = False
  20.     Frame3.Visible = True
  21. End If
  22.  
  23. End Sub
  24.  
I am sure there's more work to be done wth it, but see if you can gather anything, let us know.

Good luck with the project!

Dököll
Nov 26 '08 #2
Dököll
2,364 Expert 2GB
Let's try this one instead, I'll modify the other one momentarily, the message box is not firig, but here's on the fires an SQL command...

Expand|Select|Wrap|Line Numbers
  1.  
  2. Form code:
  3.  
  4. 'Exit database button closes the form completely
  5. Private Sub ExitDataBase_Click()
  6. On Error GoTo Err_ExitDataBase_Click
  7. 'On Load of your form to check all incomplete items
  8. Call RunMultiSQL
  9.  
  10. Dim intStore As Integer
  11. 'Count of incomplete items that are past the Expected Completion Date
  12. intStore = DCount("[qryOverDueJobs.ID]", "[qryOverDueJobs]", "[qryOverDueJobs.Incomplete] =0")
  13. 'If count of incomplete items is zero display a certain form
  14.  
In this case, I was setting a checkbox to checked if system info met certain criteria, but the idea is you are runningthe module code from here using Call RunMultiSQL

This should work in VB o VBA, I believe...

Expand|Select|Wrap|Line Numbers
  1.  
  2. Module code:
  3.  
  4. Option Compare Database
  5.  
  6. Sub RunMultiSQL()
  7.  
  8.   DoCmd.SetWarnings False
  9.   DoCmd.RunSQL ("UPDATE DETData SET Incomplete = True WHERE Emailed = True")  
  10.   DoCmd.SetWarnings False
  11.  
  12. End Sub
  13.  
  14.  
Nov 26 '08 #3
Hi There.


The sub that you're calling on module2 from module1 should be public. To do that in the declaration of your sub add the word public instead private.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Public mySub 
  3. ...
  4. ...
  5. End mySub
  6.  
  7.  
Hope this help you

Rpicilli
Nov 26 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Martin Maney | last post by:
I've been to the cookbook (both forms, since they're sometimes usefully different), but that gave rise to more questions than answers. Heck, let me pull some of them up while I'm at it. ...
2
by: Shailan | last post by:
Hi Im having trouble with the following code that seems to be behave differently when called from the browser as opposed to the command line. The calling script is a cgi that forks, with the...
8
by: Vinod | last post by:
Hi, I have a problem, i am calling an exe from asp program. Its not working fine. When i execute the exe through the dos program directly i get the desired result. My exe will convert files in...
7
by: Klaus Friese | last post by:
Hi, i'm currently working on a plugin for Adobe InDesign and i have some problems with that. I'm not really a c++ guru, maybe somebody here has an idea how to solve this. The plugin is...
9
by: soumen | last post by:
Hi, I'm a newbie compiling the following program on Sun Solaris platform for reading data from a file. The code commented as "/* WORKING */" is working (!). But in the current form of...
4
by: Miguel Dias Moura | last post by:
Hi, I just uploaded a web site and i am getting an error. I have a script which sends form values to an email using AspNetEmail. The script was working when i was calling the script like...
5
by: joeblast | last post by:
I have a Web service that gets the financial periods and hold a reference to a disconnected dataset built at initialization. Web methods work on the dataset inside the web service. Everything is...
10
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
9
by: Catherine Moroney | last post by:
I have one script (Match1) that calls a Fortran executable as a sub-process, and I want to write another script (Match4) that spawns off several instances of Match1 in parallel and then waits...
6
Soniad
by: Soniad | last post by:
Hello, I am excecuting a stored procedure in my ASP page , it has one out parameter (@confirm) . after executing the procedure i want to retreive this out parameter and assign it to variable...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.