-
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
-
<?>
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