Click here to Skip to main content
15,896,207 members

Comments by muneermohd9690 (Top 8 by date)

muneermohd9690 1-Dec-20 5:53am View    
thanks for the reply.i have found the solution.anyway i will share the code below.
muneermohd9690 12-Oct-20 13:44pm View    
thanks for the vote CHill60.if anyone needs more explanation for the solution,i would like to help.
muneermohd9690 12-Oct-20 11:18am View    
i have sumbitted the solution
muneermohd9690 1-Oct-20 13:46pm View    
Option Compare Database
Option Explicit
Private msaved As Boolean



Private Sub btnsearch_Click()

End Sub

Private Sub Command198_Click()
msaved = True
MsgBox "new record added"
Me.Requery
End Sub

Private Sub Command199_Click()
Me.Undo
DoCmd.BrowseTo acBrowseToForm, "empdetailsform", , , acFormAdd
End Sub


Private Sub browse_Click()
Dim diag As Office.FileDialog
Dim item As Variant
Set diag = Application.FileDialog(msoFileDialogFilePicker)
diag.AllowMultiSelect = False
diag.Title = "Please select an excel sheet"
diag.Filters.Clear
diag.Filters.Add "excel spreadsheet", "*.xls,*.xlsx"
If diag.Show Then
For Each item In diag.SelectedItems
Me.filename = item
Next
End If
End Sub



Private Sub Form_BeforeUpdate(cancel As Integer)
If msaved = False Then
cancel = True
Me.Undo
cancel = False
End If

End Sub

Private Sub Form_Current()
msaved = False

End Sub

Private Sub import_Click()
Dim FSO As New FileSystemObject
If Nz(Me.filename, "") = "" Then
MsgBox "Please select a file."
Exit Sub
End If

If FSO.FileExists(Nz(Me.filename, "")) Then
importexcelsheet.importexcelspreadsheet Me.filename, "empdetails"
Else
MsgBox "File not found."
End If
filename.Value = ""
End Sub
muneermohd9690 1-Oct-20 11:14am View    
how can that be done?if required i can share the access database with you.can you guide me please.