Results 1 to 2 of 2

Thread: 2 forms, Hide and Show

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Location
    Columbus, OH
    Posts
    22
    Hello all... Hpoe you can help me with this simple coding...

    Form1 has 5 option buttons and when an option is selected
    i want the caption to be populated (at cmdCalc ) in form2 and hides Form1 and i want my user when they go back (at cmdback ... hides Form2 ... showing Form1) to form1 and de-select another option, the new selected option caption
    should populate in Form2...

    But my current code below keeps the original selection caption in Form2 and does not change caption when another option is selected..

    Is my show and hide have anything to do with this??

    Code in Form1:

    Private Sub cmdOrder_Click()
    frmComputerSales.Hide

    strProcessor = ""
    If frmComputerSales.optWC700.Value = True Then
    strProcessor = frmComputerSales.optWC700.Caption
    End If

    If frmComputerSales.optWC500.Value = True Then
    strProcessor = frmComputerSales.optWC500.Caption
    End If

    If frmComputerSales.optWC800.Value = True Then
    strProcessor = frmComputerSales.optWC800.Caption
    End If

    If frmComputerSales.optWC1000.Value = True Then
    strProcessor = frmComputerSales.optWC1000.Caption
    End If

    Load frmReceipt
    frmReceipt.Show

    End Sub


    Code in Form2:

    Private Sub form_Load()
    lblProcessor.Caption = strProcessor
    End Sub

    Private Sub cmdBack_Click()
    frmReceipt.Hide
    frmComputerSales.Show
    End Sub


    Eena

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'use case select
    
    'create a bas module and put this in it.
    
    Public strProcessor As Integer
    
    'then in your frmComputerSales paste this code
    
    Option Explicit
    
    
    Private Sub cmdOrder_Click()
    frmComputerSales.Hide
    
    Select Case strProcessor
    
    Case 1
    frmReceipt.lblProcessor.Caption = frmComputerSales.optWC700.Caption
    Case 2
    frmReceipt.lblProcessor.Caption = frmComputerSales.optWC500.Caption
    Case 3
    frmReceipt.lblProcessor.Caption = frmComputerSales.optWC800.Caption
    Case 4
    frmReceipt.lblProcessor.Caption = frmComputerSales.optWC1000.Caption
    
    End Select
    
    
    Load frmReceipt
    frmReceipt.Show
    
    End Sub
    
    
    Private Sub optWC1000_Click()
    strProcessor = 4
    End Sub
    
    Private Sub optWC500_Click()
    strProcessor = 2
    End Sub
    
    Private Sub optWC700_Click()
    strProcessor = 1
    End Sub
    
    Private Sub optWC800_Click()
    strProcessor = 3
    End Sub
    
    'Code in Form2:
    'add a command button to the form
    'paste this code
    Private Sub Command1_Click()
    frmReceipt.Hide
    frmComputerSales.Show
    
    End Sub
    
    Private Sub Form_Load()
    lblProcessor.Caption = strProcessor
    End Sub
    
    Private Sub cmdBack_Click()
    frmReceipt.Hide
    frmComputerSales.Show
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width