Exporting tables and retain relationships

  • Thread starter pib311 via AccessMonster.com
  • Start date
P

pib311 via AccessMonster.com

Hello all, thanks in advance.

I have created two databases, one as a data back end and the other as the
user front end. I have tried to link tables, but on our shared network the
data is too slow. I have decided that I should export all the tables that
are used in the front end after they have been updated in the back end. To do
this, I am currently using the following code:

Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT name " & _
"FROM MSysObjects " & _
"WHERE msysobjects.type = 1 " & _
"AND msysobjects.flags = 0")

rst.MoveFirst

Do Until rst.EOF
DoCmd.TransferDatabase acExport, "Microsoft Access", _
"C:\Documents and Settings\hurtador\Desktop\hdr.mdb", acTable, _
rst!Name, rst!Name, 0
rst.MoveNext
Loop

exit_export_tables:
Exit Function
err_export_tables:
MsgBox Err.Description
GoTo exit_export_tables

End Function

The code works great, all tables I need are exported to the new location. The
only issue is that the relationships I have set do not stick. I am wondering
if this method is the best way to create these tables in the front end
database, and if so, how I would reestablish relationships that exist in the
back end version. Is there an easier way to export these that would keep the
relationships? Like I noted above, the linked option is out.

Regards,

Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top