it always opens the workstation file whenever i submit the details why
But i dont want that file(workstation) should open whenever i submit my details
i have attached my sheet
please let me know
Private Sub cmdbt1_Click()
Dim irow As Long
Dim ws As Worksheet
Dim info
info = IsWorkBookopen("\\bms\Service log request\login details\workstation.xlsx")
'we open the workbook if it is closed
If info = False Then
Workbooks.Open ("\\bms\Service log request\login details\workstation.xlsx")
End If
Set ws = Worksheets("sheet1")
'Find first empty row in database
irow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'Check for a Name number
If Trim(Me.TextBox1.Value) = "" Then
Me.lbl2.SetFocus
End If
'Copy the data to the database
ws.Cells(irow, 1).Value = Me.lbl2.Object
ws.Cells(irow, 2).Value = Me.lbl4.Object
ws.Cells(irow, 3).Value = Me.lbl6.Object
ws.Cells(irow, 4).Value = Me.TextBox1.Value
ws.Cells(irow, 5).Value = Me.TextBox2.Value
'Me.lbl2.Name = ""
'Me.lbl4.Name = ""
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox1.SetFocus
MsgBox "welcome to bms"
End Sub
Bookmarks