DoCmd.CopyObject

G

Guest

Thanks for taking the time to read my question.

I have a DB split into Front End and Back End.

I want to make a copy of a table in the back end and then have it linked to
the front end.

How can I do this? I've tried DoCmd.CopyObject but I think it's only
copying the link to the table that is in the front end.

CODE
----------------------------------
Sub CopytblHerdInformation()

On Error GoTo CopytblHerdInformation_Err

DoCmd.DeleteObject acTable, "tblHerdInformationPY"

DoCmd.Rename "tblHerdInformationPY", acTable, "tblHerdInformation"
DoCmd.CopyObject , "tblHerdInformation", acTable, "tblHerdInformationPY"
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblHerdInformationPY SET
tblHerdInformationPY.NumberOfFreeVisits = 0, tblHerdInformationPY.New =
False;"
DoCmd.SetWarnings True

CopytblHerdInformation_Exit:
Exit Sub


CopytblHerdInformation_Err:
If Err.Number = 3011 Then
Resume Next
Else
MsgBox Err.Number & ", " & Err.Description
Resume CopytblHerdInformation_Exit
End If

End Sub
 

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