I don't know if this is a bug or my not understanding how to use the
OpenOffice.org Start Application event.
The macro I attach to the event starts a dialog that uses a table in my
DBInfo.odb which is located on a shared drive.  Quickstart is loaded at
computer startup and shows my To Do list and appointments.  I have 3
computers on my home network.  Normally I start Computer 1 in the morning,
the dialog works as expected, I close, it do normal stuff, later I leave the
computer running and move to Computer 2 which is configured the same, power
it on, the dialog appears, I close it and work normally using the drive
shared from Computer 1.

However, maybe once a month, the dialog fails when I start Computer 2.  I
can open the database (Computer 2) but cannot connect to the table.  It took
a while to find it but it appears that Quickstart does not allways release
the table when the dialog closes.  If I go to Computer 1 and exit Quickstart
Computer 2 works normally.

Is there a command somewhere that I can add to my macro to insure the table
is released?

Computer 1 - a Dell    running XPpro
Computer 2 - a Compact running Vista home premimum
Both computers are using OpenOffice 3.1.0

As you might guess I am still in the process of learning how to program
Base, here is the macro that starts the dialog

Sub fm_Tasks()
  'Purpose:   Show xx_Forms dialog dlgTASKS, uses DBInfo table TASKS
  'Version:   9.000 12/18/09

  ON ERROR GOTO HandelErr
  Const cstrProc as string = "fm_Tasks"
  Dim oConn      As Object
  Dim oLib       As Object
  Dim oDialog    As Object
  Dim oShowDlg   As Object
  Dim oDialogFld  as Object
  Dim oStmt      As Object    'statment obj needed to create rowset
  Dim rsObj      As Object    'rowset created from strSQL
  Dim lblToday   As Object
  Dim lblDB      As Object
  Dim strDB      as String    'DB name of registered database
  Dim strLib     as String
  Dim strSQL     as String
  Dim strLBitem  as String    'item line for dialog listbox
  Dim strYY      as string
  Dim strTmp     as string
  Dim strTime    as string
  Dim strDate    as String
  Dim intDays    as Integer
  Dim dtmDate    as Date
  Dim blnOK      as boolean

  strDB = "DBInfo"          'TaskDBCompact                must be a
registered DBname
  oConn = tb_Connect(strDB)
  If IsNull(oConn) Then
    MsgBox "Could not connect to: " & strDB, 0, cstrProc
    GoTo ExitHere
  End If

  blnOK = com.sun.star.ui.dialogs.ExecutableDialogResults.OK
  oLib = DialogLibraries.GetByName("xx_Forms")
  oDialog = oLib.GetByName("dlgTASKS")
  oShowDlg = CreateUnoDialog(oDialog)

  lblToday = oShowDlg.GetControl("lblToday")
  lblToday.Text = Format(Date, "mm/dd/yy") & "  " & Format(DatePart("w",
Date), "dddd")
  lblDB = oShowDlg.GetControl("lblDB")
  lblDB.Text = strDB
  lblDB = oShowDlg.GetControl("lblPath")
  lblDB.Text = gstrTextPath

  oDialogFld = oShowDlg.GetControl("lstTasks")

  strSQL= "SELECT TSKTIME, TSKDATE, DESCRIPTION FROM TASKS AS TASKS WHERE
TSKDATE > CURRENT_DATE"
  oStmt = oConn.createStatement
  rsObj = oStmt.executeQuery(strSQL)
  While rsObj.next
    strTmp = rsObj.getString(1)
    If Len(strTmp) < 3 Then
      strTime = "....... "
    Else
      strTime = Left$(strTmp, 5) & " "
    End If

    dtmDate = rsObj.getString(2)
    intDays = DateDiff("d", Date, dtmDate)
    strTmp = rsObj.getString(2)      '  YYYY-MM-DD
    strDate = Mid$(strTmp,6,2) & "/" & Mid$(strTmp,9,2) & "/" &
Mid$(strTmp,3,2)
    strLBitem = Format(intDays, "0000") & " " & strTime & " " & strDate & "
" & rsObj.getString(3)
    oDialogFld.additem(strLBitem, oDialogFld.ItemCount)
  Wend
  oShowDlg.setTitle("[My Macros & Dialogs].xx_General Module: Start    CPU:
" & gstrCPUname)
  oShowDlg.Execute()

ExitHere:
  On Error Resume Next
  oConn.Close
  Exit Sub

HandelErr:
  Call xx_Print(2,  Err & ": " & Error$ & mcstrMod & "."  & cstrProc & "
Ln:"  & Erl)
  Msgbox Err & ": " & Error$ & mcstrMod & " Ln:"  & Erl, 16,  mcstrMod &
"."  & cstrProc
  GoTo ExitHere
End Sub

Reply via email to