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

Merging Of MDB Files

100+
P: 198
Hello sir.
I am making a program on merging in Visual Basic. The program is that I have a folder which is not on my hard drive contain 80 Mdb files and each Mdb file contains two tables.
I want to merge all the Mdb files into a new Mdb file using a single execution or in one loop. I have some coding, please correct it or modify. I don't know how to move from one database to another.
Expand|Select|Wrap|Line Numbers
  1. Set dbparent = Workspaces(0).OpenDatabase(txtparentMDBFile)
  2. schildpath = txtchildMDBFile
  3.  
  4. For i = 1 To File1.ListCount
  5.   sfilepath = Dir(schildpath & "\" & frmpath.Text1.Text)
  6. lblmerge.Caption = " Files Merged = "
  7.   Do While sfilepath <> ""
  8.     icount = icount + 1
  9.     squery = "insert into " & txtparenttable & " IN '" & txtparentMDBFile & "' select Sbjct, CmpnyNm, Yp1EStartTime, Yp1EEndTime from " & txtchildtable & " IN '" & schildpath & "\" & sfilepath & "'"
  10.     dbparent.Execute squery
  11.     sfilepath = Dir(schildpath)
  12.     lblcount.Caption = icount
  13.     lblcount.Refresh
  14.   Loop
  15. Next
Nov 12 '07 #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.