Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't populate partial replicat

    Trying to make my first Acc97 partial replica using VBA code. Used some code from a MS article (??), and modified it for my purposes. Can't open the partial replica database in Exclusive mode using VBA even though I can open it Exclusive with the Access user interface. If I open the file non-exclusive, it fails in the db.populatepartial method.

    Any help appreciated.

    ************************
    Option Compare Database
    Option Explicit

    Const sDBPARTIALName As String = "I:systemcorpdataAdmanBE.WDCorp.mdb"
    Const sDBMASTER As String = "H:COMPUTERAdMANReplicateAdmanBE.DesignMaster. mdb"

    Public Function CreatePartialReplica()
    Dim db As Database
    Set db = OpenDatabase(sDBMASTER)

    db.MakeReplica sDBPARTIALName, "WD version of only CORPORATE data", dbRepMakePartial
    db.Close
    End Function


    Public Function CreatePartialFilter()
    Dim db As Database
    Dim rs As Recordset

    Dim tdf As TableDef
    Dim rel As Relation


    Set db = OpenDatabase(sDBPARTIALName, True)
    Set rs = CurrentDb.OpenRecordset("dLkupPartiallyReplicatedT ableNames")

    While Not rs.EOF
    Set tdf = db.TableDefs(rs!tablename)
    tdf.ReplicaFilter = "RecordstatusID = 1 OR RecordstatusID = 2"

    For Each rel In db.Relations
    If rel.Table = rs!tablename Or rel.ForeignTable = rs!tablename Then
    rel.PartialReplica = True
    End If
    Next rel

    rs.MoveNext
    Wend

    db.Close
    MsgBox "done"
    End Function

    Public Function PopulatePartial()
    Dim db As Database

    Set db = OpenDatabase(sDBPARTIALName, True)
    db.PopulatePartial sDBMASTER
    db.Close

    End Function
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  2. #2
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Winnipeg, Canada
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't populate partial replicat

    Hi,

    Before I look at this any further, I am curious about the following syntax: AdmanBE.WDCorp.mdb

    What is the purpose/significance of the first period? <img src=/S/frown.gif border=0 alt=frown width=15 height=15>

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't populate partial replicat

    No real significance -- I had just gotten into the habit of differentiating the purpose of the db with an additional part of the name. This particular filename means to be:
    "ADMan - BackEnd - purpose is WestDivisional Corporate"
    Maybe I should try it without the periods -- stranger things have happened...
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't populate partial replicat

    In the line:
    Set db = OpenDatabase(sDBPARTIALName, True)
    Set rs = CurrentDb.OpenRecordset("dLkupPartiallyReplicatedT ableNames")


    What userID will be used for the new database? Will it be the default Admin user, or will it be the user of the currently-running Access session? I am currently logged in as Programmer, which is the owner of the database. The Admin user has very restricted permissions.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Can't populate partial replicat

    Get out of the habit of using periods in file names <big>immediately!</big> Periods have specific meaning to the operating system, and it is a very bad idea to preempt that meaning. It will work OK most of the time and bite you badly when you least expect it.
    Charlotte

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Can't populate partial replicat

    Unless you pass the specific UserID and password, you will be logged into the new database object as Admin.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •