Good Morning

I am using & access ,I have a office.mdb file ,now i want that when i click on a button that automatically must have that .mdb file & than must display a savedialogbox & where user give the location for saving that .mdb file that must be save,

Please help me to solve it

Here's two solutions to save a file

Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
  SaveFileDialog1.AddExtension = True
  SaveFileDialog1.CheckPathExists = True
  SaveFileDialog1.DefaultExt = "mdb"
  SaveFileDialog1.FileName = "D:\BlogTest.mdb" ' Put here the filename
  SaveFileDialog1.Filter = "MS Access Files (*.mdb)|*.mdb"
  'SaveFileDialog1.InitialDirectory = "<set initial folder if needed>"
  SaveFileDialog1.OverwritePrompt = True
  If SaveFileDialog1.ShowDialog <> Windows.Forms.DialogResult.Yes Then
    ' User did not save the file!
    ' Save the file
  End If

  ' OR

  FolderBrowserDialog1.Description = "Save MS Access File"
  'FolderBrowserDialog1.SelectedPath = "<set initial folder if needed>"
  'FolderBrowserDialog1.ShowNewFolderButton = True ' Allow user to create a directory?
  If FolderBrowserDialog1.ShowDialog() <> Windows.Forms.DialogResult.OK Then
    ' User did not select a directory!
    ' User selected the directory, copy file to that directory
    ' Notice: Here's hard coded file names, you may use a variable to hold the filename
    My.Computer.FileSystem.CopyFile("D:\BlogTest.mdb", FolderBrowserDialog1.SelectedPath & "BlogTest.mdb")
  End If

End Sub

The first solution allows the user to change the file name. If you do not want the user to change the file name, use the FolderBrowserDialog.

Hi! Nice to hear that you got answer to your problem, could you please mark the thread as solved. Thank you!