access数据库合并问题

来源:百度知道 编辑:UC知道 时间:2024/06/02 17:00:17
就业失业登记系统 前台VB后台ACCESS 现在办的人很多 系统能执行SQL语句
现在办的人太多想分开办公 以后合并 有没有办法???

可以合并,需要写一段vba的程序,打开一个新数据库,用insert into ... select...语句插入所有要合并的数据库的数据.

下面是我写的一段程序你可以参考一下.
Dim db As DAO.Database
Dim strSql As String
Dim i As Integer
...
For i = 1 To numberOfSites
If i = 1 Then
strSql = "Select orders.* " & _
" INTO allOrders " & _
" IN '" & CurrentProject.Path & "\" & strNewDBFile & "' " & _
" FROM orders "
Else
strSql = "INSERT INTO allOrders " & _
" IN '" & CurrentProject.Path & "\" & strNewDBFile & "' " & _
" Select orders.* " & _
" FROM orders "
End If
db.Execute strSql, dbFailOnError
Next