[Solved] Object variable not set error message
Posted: Thu Feb 24, 2011 7:27 am
The following code snipped is taken from a basic documentation:
looks very straightforward, but running this code always throws an exception :
"BASIC runtime error: Object variable not set" at the line
dataSource = databaseContext.getByName("Customers").
What did I wrong here? Or is it the result of a bug? Is there a way to work
around by formulation the code differently?
Any helpful suggestion would be highly appreciated.
Thanks in anticipation.
Title Edited. A descriptive title for posts helps others who are searching for solutions and increases the chances of a reply. BBCode fixed also (Hagar, Moderator).
Code: Select all
dim databaseContext as object
dim dataSource as object
dim queryDefinitions as object
dim queryDefinition as object
dim statement as object
dim resultSet as object
dim I as integer
databaseContext = createUnoService("com.sun.star.sdb.databaseContext")
dataSource = databaseContext.getByName("Customers")
queryDefinitions = dataSource.getQueryDefinitions()
for I = 0 to queryDefinitions.count()-1
queryDefinition = queryDefinitions(I)
msgbox queryDefinition.name
next I"BASIC runtime error: Object variable not set" at the line
dataSource = databaseContext.getByName("Customers").
What did I wrong here? Or is it the result of a bug? Is there a way to work
around by formulation the code differently?
Any helpful suggestion would be highly appreciated.
Thanks in anticipation.
Title Edited. A descriptive title for posts helps others who are searching for solutions and increases the chances of a reply. BBCode fixed also (Hagar, Moderator).