Having a problem with Geopak GetJobNumbersWithinAcdtiveDir

I have one VBA that will not find the gpk file. Using the same code that works on the other VBA. Below is the code from the example which is used to check. The result returns the path/jobjob104.gpk

 Dim jobNums()   As String
    Dim count       As Integer
    Dim myCogo      As Cogo

    'Array of Job Numbers
    jobNums() = GetJobNumbersWithinActiveDir()

    For count = LBound(jobNums) To UBound(jobNums)
        'Get the first Job Number in the array
        If 0 = count Then
            'Set the active Job Number
            Set myCogo = OpenCogoByJobNumber(104)
            'Set myCogo = OpenCogoByJobNumber(jobNums(count))

            If (myCogo Is Nothing) Then
                MsgBox "error reading job: " & jobNums(count)
            Else
                MsgBox myCogo.FullFileName
            End If

        End If

    Next count

Parents Reply Children
  • Larry,
    Are you using a different data set with this VBA than the others you say are working? I've seen this occur when the data set contains a gpk file that doesn't follow the naming standard of 'job104.gpk'. Perhaps you have a 'Copy of job104.gpk' in your gpk folder...?
  • Bruce,

    Same project and same session. There is only one gpk in the directory. I have hard coded the gpk number to make it work for a deadline.

    Larry Wilson
    LWilson@LJBinc.com
     

  • Hi Larry,

    could you please execute this code below and send us the output of the debug statements - thank you in advance.

    Artur



    Option Explicit Sub COGO_SetActiveJobNumber() Dim jobNums() As String Dim count As Integer Dim myCogo As Cogo 'Array of Job Numbers jobNums() = GetJobNumbersWithinActiveDir() For count = LBound(jobNums) To UBound(jobNums) 'Get the first Job Number in the array If 0 = count Then 'Set the active Job Number Set myCogo = OpenCogoByJobNumber(104) ' Set myCogo = OpenCogoByJobNumber(jobNums(count)) ' Geopak GPK active dir location logic: Dim arrCfgVars() As Variant Dim cfg As Variant arrCfgVars = Array("GPK_JOBDIR", "GPK_CWD", "_DGNFILE") For Each cfg In arrCfgVars If (ActiveWorkspace.IsConfigurationVariableDefined(cfg)) Then Debug.Print cfg & ": " & ActiveWorkspace.ConfigurationVariableValue(cfg, True) Else Debug.Print cfg & ": " & "NOT DEFINED" End If Next Debug.Print "Cogo.FullFileName: " & myCogo.FullFileName If (myCogo Is Nothing) Then MsgBox "error reading job: " & jobNums(count) Else MsgBox myCogo.FullFileName End If End If Next count End Sub

  • Artur,
    here is the results

    GPK_JOBDIR: Q:\City of Trotwood\0106104A.00 - MOT-Wolf Creek Pike Improv\88223\geopak\
    GPK_CWD: Q:\City of Trotwood\0106104A.00 - MOT-Wolf Creek Pike Improv\88223\geopak
    _DGNFILE: Q:\City of Trotwood\0106104A.00 - MOT-Wolf Creek Pike Improv\88223\row\sheets\88223RB016.dgn
    Cogo.FullFileName: Q:\City of Trotwood\0106104A.00 - MOT-Wolf Creek Pike Improv\88223\geopak\\jobjob104.gpk

    Larry Wilson
    LWilson@LJBinc.com
     

  • Hi Larry,
    as a result of this test we can assume that the .gpk file is found.
    In the following the value ...\\jobjob104.gpk for Cogo.FullFileName is not necessary a problem.

    In your next code block after finding and selecting the active job, which problems occur?
    Do you receive any error message or what indicator for a problem do you receive?

    The drive Q: let us assume the project is placed on a network drive.
    Do you also experience this problem with local files?

    Could you also provide us a complete testcase?

    Best regards,
    Artur