473,386 Members | 1,745 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,386 software developers and data experts.

Call form from module

kirubagari
158 100+
I want to call a form from a module.
My code as below

Expand|Select|Wrap|Line Numbers
  1.   Dim oGetHoldForm As frmHold
  2.  
  3.        If sActionType = "HOLD" Then
  4.           Set oGetHoldForm = frmHold
  5.          End If
Im having problem and it doesnt go into the form that i want.Kindly help
Mar 3 '11 #1
5 4922
Guido Geurs
767 Expert 512MB
In the form calling the module put:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.    Call OpenForm
  3. End Sub
In the Module place:
Expand|Select|Wrap|Line Numbers
  1. Public Sub OpenForm()
  2.    Form2.Show
  3. End Sub
Mar 3 '11 #2
kirubagari
158 100+
Dear Guido,

I want to call the form from the module when i click the action type and the action type is hold and i'm passing the parameter in this function.

So my code as below:
Expand|Select|Wrap|Line Numbers
  1. call from module Public Function HoldReleaseLot(sActionType As String) As String
  2.  
  3.         '*** START FAILSAFE ***
  4.        On Error GoTo FailSafe_Error    'setup error handler
  5.         Push "HoldReleaseLot.bas", "Function HoldReleaseLot", "(" & ")"
  6.         Trace "Enter", 9
  7.      '*** STOP FAILSAFE ********************************************************************************************************************************
  8.         Dim sID As String
  9.        Dim sCommentCode As Strings
  10.          Dim sBrifDes As String
  11.       Dim sFullDesc As String
  12.        Dim iHoldMousePointer As Integer
  13.        Dim sReturnText As String
  14.        Dim bSuccessful As Boolean
  15.       Dim oGetCommentForm As Form
  16.        Dim ofrmRelease As frmRelease
  17.        Dim oGetHoldForm As frmHold
  18.        Dim sHoldComment As String
  19.        Dim oHistory As FwLotHistory
  20.        Dim bRelease As Boolean
  21.        Dim vUserGroup As Variant
  22.        Dim bDIFAlarmGroup As Boolean 
  23.        Dim sHoldReasonCode As String
  24.        Dim bPREFGroup As Boolean       
  25.        Dim iSelect As Integer
  26.       Dim bRehold As Boolean
  27.       Dim IsToolF1 As Boolean
  28.        Dim objILPStep As FwStep
  29.        Dim cNextStep As FwAggregateStep
  30.        Dim cCurrPlan As FwProcessPlan
  31.  
  32.        Screen.MousePointer = vbHourglass
  33.  
  34.  
  35.        HoldReleaseLot = VBRULE_FAIL
  36.  
  37.        If sActionType = "HOLD" Then
  38.            Set oGetHoldForm = frmHold
  39.        End If
  40.       ''
  41.       If sActionType = "Hold" And LCase(rc.Lot.status) = "hold" Then
  42.            'If any dispatch list is selected, have to select Hold rule from Activities>WIP>Hold Lot, if from lot query, just right click and Hold Lot.
  43.           bRehold = False
  44.            'sReturnText = "This lot is already on hold."
  45.            iSelect = LSIMsgBox("This lot is already on HOLD. Are you sure to re-hold with different hold code and comment?", vbYesNo + vbExclamation, rc.ruleName)
  46.            If iSelect = vbNo Then
  47.               GoTo Cancel
  48.            Else
  49.               bRehold = True
  50.            End If
  51.        End If
  52. call from form
  53. Private Sub Form_Load()
  54.         '*** START FAILSAFE ***
  55.        On Error GoTo FailSafe_Error    'setup error handler
  56.         Push "Hold.frm", "Sub Form_Load", "(" & ")"
  57.         Trace "Enter", 9
  58.         '*** STOP FAILSAFE ********************************************************************************************************************************
  59.         CenterForm Me
  60.         '*** START FAILSAFE ********************************************************************************************************************************
  61.  FailSafe_Exit:
  62.         Trace "Exit", 9
  63.        Pop
  64.        Exit Sub
  65.  FailSafe_Error:
  66.        ' *** Insert Special Error Handling Here ***
  67.        LogError
  68.        Resume FailSafe_Exit             'default is to exit this procedure
  69.       '*** STOP FAILSAFE ***
  70. End Sub
Kindly help.
Mar 4 '11 #3
Guido Geurs
767 Expert 512MB
Is this VB6 ??? (Push, Trace, CenterForm ...???)
If not, please place your call in the right forum.
Mar 4 '11 #4
kirubagari
158 100+
Yes in VB6..Im using that push,trace and center form and im just following the previous developer function..push ,trace center form is all the function
Mar 4 '11 #5
Guido Geurs
767 Expert 512MB
I hope this will help you: see attachment
Expand|Select|Wrap|Line Numbers
  1. ...
  2.    Screen.MousePointer = vbHourglass
  3.    HoldReleaseLot = VBRULE_FAIL
  4.  
  5.  
  6. '§ ?????????????????????????????
  7.    If sActionType = "HOLD" Then
  8.       FrmHold.Show
  9.    End If
  10. '§ ???????????????????????????????
  11.  
  12. '   If sActionType = "Hold" And LCase(rc.Lot.Status) = "hold" Then
  13.       '§ If any dispatch list is selected,
  14.       '§ have to select Hold rule from Activities>WIP>Hold Lot,
  15. ...
PS: I have comment a lot of code for a test because I don't have all the code!
Attached Files
File Type: zip Call form from module_v1.zip (3.0 KB, 147 views)
Mar 5 '11 #6

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

Similar topics

2
by: MLH | last post by:
I have a form module that starts out something like this... Option Compare Database 'Use database order for string comparisons ..... Then there's a line like this in it... Public Const...
9
by: MLH | last post by:
Would the following work if placed in a form module rather than a global module? Declare Sub InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long)
2
by: Andrew Wrigley | last post by:
Hi I have a database that works OK except in two regards, that I suspect are related. Problem 1. After even minor changes to a form module (ContactFrm), such as editing a comment, I hit the...
2
by: MLH | last post by:
I would like to call a function stored in a form module in Access 2.0 from an Access 2.0 procedure in a global module. Function EmailTheOutletters () in module AppSpecific... .... 560 SSNtext...
2
by: MLH | last post by:
A97 allows separate procedures in a form module to share common label names. Access 2.0 would puke when that happened. For instance, if I had 2 procedures in an Access 2.0 form module with labels...
4
by: Martijn Mulder | last post by:
I have a menu option 'Open...' that opens an OpenFileDialog to select an image file to open. Than I need to call Form.Invalidate() to clear the Form and display the image. This happens in a...
1
by: foocc | last post by:
Hi, I would like to know how to call a module in vb.net? I received this warning : TypeInitializeException was unhandled. The type initializer for 'SAPWVA.basDetail' threw an exception. Below...
2
by: ozzie8 | last post by:
I am try to get a macro to call a module, which in turn calls a VBA form but am having no luck at all. Can anyone help me out? I am trying to use the OpenModule action in the Macro. I have set the...
7
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I am trying to see if I can call a Library remotely. The library contains a Form that I want to display then pass back some data to user that called this form remotely. I have it working...
5
by: jamesnkk | last post by:
I have many forms, in every form, I need to validate a Process, so instead of coding to every forms, I could think of using module, but not sure how to do it. (1). In each form how do I call the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.