NilObjectException while testing for DB connection

I am getting a NilOjectException error on the first line of the If statement:

JHGCDB is the variable name of the Sqlite DataBase I am connecting to.

[code]If (JHGCDB.Connect) = True Then ’ <-- This is where the wee bug symbol appears just before the NilObjectException error message
recSet = JHGCDB.SQLSelect(“SELECT * FROM tblLogin”)

If(recSet) = Nil Then
MsgBox "Record Set Error: " + Str(JHGCDB.ErrorCode) + EndOfLine + EndOfLine +JHGCDB.ErrorMessage _
+ EndOfLine + EndOfLine + “Error generated from: modSel.mthRoute”
Exit

Else
Return recSet

End If

Else
If JHGCDB.Error Then
// Testing for issues in the DB tissues!
Beep
MsgBox "Database Error: " + Str(JHGCDB.ErrorCode) + EndOfLine + EndOfLine + JHGCDB.ErrorMessage
Exit

End If

MsgBox "I do not believe the database is connected! " + Str(JHGCDB.ErrorCode) + EndOfLine + EndOfLine + JHGCDB.ErrorMessage

End If[/code]

I used to use RealBasic and have been out of the programming loop for a few years. And not I am back in with a new project so I figure I can reuse a lot of my previous code (save time) and tweak as needed for this new project. Anyhow I used the menu method to add my database, now I am trying to connect to it and begin populating a ComboBox on load. The query above is in Method a Module that I can call as needed though out the program.

But…

have you created an instance of JHGCDB before you try to connect ?
a NilObjectException would suggest you have not

I think I did. But I may have placed it in the wrong place? I’ll look at it when I get a moment … thank you for your time and answer!

Okay… here is everything I have set up… and now I have a different error…

modSelQry.JHGCDB Declaration This global variable has the same name as a global function. You must resolve this conflict JHGCDB As SQLiteDatabase

In the App.EventHandler I have the following:

[code]’ Primary Variable Declaration(s)
Dim fldrItm As FolderItem = modDbConn.mthGetAppFldr()

’ Function(s) / Logic…
JHGCDB= New SQLiteDatabase // Instantiate a new instance

fldrItm = fldrItm.Child(“DB”).Child(“JHGCDB.sqlite”) // Define the location and load the variable

// Test to ensure the folder and database actually exist.
If(fldrItm) <> Nil Then
If(fldrItm.Exists) Then
JHGCDB.DatabaseFile = fldrItm

Else
MsgBox “Database isn’t there.” + EndOfLine + Str(JHGCDB.ErrorCode) + EndOfLine + JHGCDB.ErrorMessage _
+ “Error Message AGGRESSIVELY thrown from the App.Open”
Return

End If

Else
MsgBox “The folder containing the database isn’t there!” + EndOfLine + “Error Message AGGRESSIVELY thrown from the App.Open”
Return

End If[/code]

Next in a Module named modDbConn I have a Method called mthGetAppFldr

[code]’ Primary Variable Declaration(s)
Dim flrItm As FolderItem = GetFolderItem("")

// Function(s)…
#If DebugBuild Then flrItm = flrItm.Parent

Return flrItm[/code]

Next I have in modDbConn a Property with the following settings:
Name: JHGCDB
Type: SQLiteDatabase
Default:
Scope: Global

This set up is one I have used in the older version of RealBasic and instead of SQLiteDatabase it was identified as REALSQLDatabase. I basically used two of my older programs to set up the DB connection… has something changed?