Form won't close
Is something wrong with my code? I'm working with Microsoft eMbedded Tools, and when I get to the second form it won't close when I hit the OK button. It should close everything, but it won't unload form2 and it is eating my memory.
Option Explicit
Private Sub Form_OKClick()
'unload everything and close program
Unload (Form1)
Unload (Form2)
Unload (Form3)
Unload (Form4)
App.End
End Sub
Private Sub Command1_Click()
' Save Data to invisible string
Form2.Text7 = "Barcode: " + Form2.Text1 + vbCrLf + "Serial Number: " + Form2.Text2 + vbCrLf + "Model: " + Form2.Text3 + vbCrLf + "date: " + Form2.Text4 + vbCrLf + "Owner: " + Form2.Text5 + vbCrLf + "Comments: " + Form2.Text6
Form2.Text1 = ""
Form2.Text2 = ""
Form2.Text3 = ""
Form2.Text4 = Date
Form2.Text5 = "ETL"
Form2.Text6 = ""
' Pop Up confirmation
MsgBox Form2.Text7, vbOKCancel
End Sub
Private Sub Command2_Click()
'Clear all data in fields
Form2.Text1 = ""
Form2.Text2 = ""
Form2.Text3 = ""
Form2.Text4 = Date
Form2.Text5 = "ETL"
Form2.Text6 = ""
'Close the form, pop up the new one
Form1.Show
Form2.Hide
End Sub
Private Sub Form_Load()
Form2.Text4 = Date
Form2.Text5 = "ETL"
End Sub
|