By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

How to Import and Export Ms Access data using 2008

P: 1
Hi guys,

I need a help. I have EmployeesInfo system with several tables (Employees, Payroll and Purchases tables) in Ms Access Database and forms in Vb.Net accordingly.

How can I Export and Import data from Ms Access Database using 2008 ?. Can anyone help me with codes ?. I had coded but does not work !.

Expand|Select|Wrap|Line Numbers
  1. Private Sub ExportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExportToolStripMenuItem.Click
  2.         Dim source, target As String
  3.         source = Application.CommonAppDataPath & "\EmployeesInfo.mdb" 'this is the path where vb stores databse file. 
  4.         If SaveFileDialog1.ShowDialog() <> Windows.Forms.DialogResult.Cancel Then 'sfdFile is save file dialogue 
  5.             target = SaveFileDialog1.FileName
  6.             Try
  7.                 My.Computer.FileSystem.CopyFile(source, target, True)
  8.                 MsgBox("Export Completed Successfully")
  9.             Catch ex As Exception
  10.                 MsgBox(ex.Message)
  11.             End Try
  12.         End If
  13.     End Sub
  16. Private Sub ImportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImportToolStripMenuItem.Click
  17.         Dim source, target As String
  18.         If OpenFileDialog1.ShowDialog() <> Windows.Forms.DialogResult.Cancel Then ' ofdFile is open file dialouge 
  19.             source = OpenFileDialog1.FileName
  20.             target = Application.CommonAppDataPath & "\EmployeesInfo.mdb"
  21.             Try
  22.                 My.Computer.FileSystem.CopyFile(source, target, True)
  23.                 MsgBox("Import Completed Successfully")
  24.             Catch ex As Exception
  25.                 MsgBox(ex.Message)
  26.             End Try
  28.         End If
  30.     End Sub
Oct 31 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.