Once a database has been published and a local copy of the database is opened, the user sees the Publish option in the message bar. This option enables the user to quickly republish a database when changes have been made to it. The PublishURL database property is used to determine if and where the database is published and can easily be accessed with a single line of VBA code. The following is an example function that returns PublishURL if it exists:
Function GetPublishURL() As String
On Error GoTo errFailed
' Return the PublishURL
GetPublishURL = CurrentDb.Properties("PublishURL").Value Exit Function errFailed:
' If there is an error, the PublishURL does not exist GetPublishURL = "" Exit Function
You can programmatically add, modify, or remove this property just as easily. For example, you may not want the user to see the publish bar when the database is opened, so you could add some code to automatically clear this property when the database is opened.
Was this article helpful?