Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Application.CurrentDb etc. throws error

I am getting to grips with Libre Basic via the helpful link text

In that page it clearly states one can refer to the current database as either Application.CurrentDb, or just CurrentDb. Equally, the forms collection can be referenced as 'Forms("formname") and the other collections should work the same way.

Clearly I am doing something wrong, because when I write a macro including that statement, I get an error.

Sub subTest
    Dim odbTimbercraft As Object
    Set odbTimbercraft = CurrentDb
End Sub

The 'Set' statement throws this error: "Basic runtime error - Object variable not set"

What am I doing wrong?

Any help would be appreciated.

Application.CurrentDb etc. throws error

I am getting to grips with Libre Basic via the helpful link text

In that page it clearly states one can refer to the current database as either Application.CurrentDb, or just CurrentDb. Equally, the forms collection can be referenced as 'Forms("formname") and the other collections should work the same way.

Clearly I am doing something wrong, because when I write a macro including that statement, I get an error.

Sub subTest
    Dim odbTimbercraft As Object
    Set odbTimbercraft = CurrentDb
End Sub

The 'Set' statement throws this error: "Basic runtime error - Object variable not set"

What am I doing wrong?

Any help would be appreciated.

Later ...

I have since found a partial clue. In form frmOrders I have attached this macro to a button:

Sub subTest2
    Dim frmMyForm as Object
    Set frmMyForm = getObject(Forms!frmOrders)
End Sub

When I click the button, the code still throws an error at the Set statement, but it is more helpful: "BASIC runtime error. Property or method not found: frmOrders". As it is being invoked from frmOrders, I am puzzled as to what is going on.

I am sure I am looking at an incorrect or out-of-date object model for Base, but don't know where to look for further information. "8-<