By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,667 Members | 2,603 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,667 IT Pros & Developers. It's quick & easy.

Call form from module

kirubagari
100+
P: 158
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
Share this Question
Share on Google+
5 Replies


Guido Geurs
Expert 100+
P: 767
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
100+
P: 158
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
Expert 100+
P: 767
Is this VB6 ??? (Push, Trace, CenterForm ...???)
If not, please place your call in the right forum.
Mar 4 '11 #4

kirubagari
100+
P: 158
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
Expert 100+
P: 767
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, 117 views)
Mar 5 '11 #6

Post your reply

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