Good Morning,
I am using the following code to submit a form that is completed by an agent in work. The file keeps closing when it has submitted and i need it to re loop after the Msg box at the end. If it it finds no open enquiries i need it then to confirm no work outstanding. Then to the file needs to stay open on the "Front Sheet" Tab
Any help would be appreciated
Private Sub cmdsubmit_Click()
Dim iRow As Long
Dim ws As Worksheet
If Me.JEN.Value = "" Then
MsgBox "Please Complete is this a justified Enquiry"
Else
If Me.AComm.Value = "" Then
MsgBox "Please Leave Your Comments"
Else
If Me.CBoxAdd.Value = "" Then
MsgBox "Please Enter Your Name"
Else
If Me.TextBox12.Value = "" Then
MsgBox "Please Enter Todays Date"
Else
Workbooks.Open Filename:="\\W2K6082\COMMON\SHARED\Simone's Team\Misc Spreadsheets\SimoneData.xls" 'File saved area
Set ws = Worksheets("Data")
iRow = ws.Cells(Rows.Count, 11) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
ws.Cells(iRow, 11).Value = Me.JEN.Value
ws.Cells(iRow, 12).Value = Me.AComm.Value
ws.Cells(iRow, 13).Value = Me.CBoxAdd.Value
ws.Cells(iRow, 14).Value = Me.TextBox12.Value
'clear the data
Me.JEN.Value = ""
Me.AComm.Value = ""
Me.CBoxAdd.Value = ""
Me.TextBox12.Value = ""
Me.txtdate.Enabled = True
Me.txtdate.SetFocus
Windows("SimoneData.xls").Activate
ActiveWindow.Close (True)
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
MsgBox "Your Car Park has been Completed"
ActiveWorkbook.Close False
End If
End If
End If
End If
End Sub
I am using the following code to submit a form that is completed by an agent in work. The file keeps closing when it has submitted and i need it to re loop after the Msg box at the end. If it it finds no open enquiries i need it then to confirm no work outstanding. Then to the file needs to stay open on the "Front Sheet" Tab
Any help would be appreciated
Private Sub cmdsubmit_Click()
Dim iRow As Long
Dim ws As Worksheet
If Me.JEN.Value = "" Then
MsgBox "Please Complete is this a justified Enquiry"
Else
If Me.AComm.Value = "" Then
MsgBox "Please Leave Your Comments"
Else
If Me.CBoxAdd.Value = "" Then
MsgBox "Please Enter Your Name"
Else
If Me.TextBox12.Value = "" Then
MsgBox "Please Enter Todays Date"
Else
Workbooks.Open Filename:="\\W2K6082\COMMON\SHARED\Simone's Team\Misc Spreadsheets\SimoneData.xls" 'File saved area
Set ws = Worksheets("Data")
iRow = ws.Cells(Rows.Count, 11) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
ws.Cells(iRow, 11).Value = Me.JEN.Value
ws.Cells(iRow, 12).Value = Me.AComm.Value
ws.Cells(iRow, 13).Value = Me.CBoxAdd.Value
ws.Cells(iRow, 14).Value = Me.TextBox12.Value
'clear the data
Me.JEN.Value = ""
Me.AComm.Value = ""
Me.CBoxAdd.Value = ""
Me.TextBox12.Value = ""
Me.txtdate.Enabled = True
Me.txtdate.SetFocus
Windows("SimoneData.xls").Activate
ActiveWindow.Close (True)
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
MsgBox "Your Car Park has been Completed"
ActiveWorkbook.Close False
End If
End If
End If
End If
End Sub