Nil Object Exception

Dim dbFile As FolderItem dbFile = GetFolderItem("file:///Z:/Documents/Xojo%20Projects/SmartProject/database.sqlite",FolderItem.PathTypeURL) If dbFile.Exists Then App.db.DatabaseFile = dbFile <<---- Nil Object Exception Else MsgBox("The FolderItem does not exist.") End If

Any ideas as to why? The file path is valid.

Edit (Paul): Added Code tags as described in Post Formatting Tips

Did you instantiate App.DB somewhere?

App.DB = New SQLiteDatabase

Is there supposed to be 3 slashes after file:?

Yes, Paul, that was it. I has it set incorrectly.

Garth, 3 slashes is correct for URL path.

As an aside, in the future, please use the code tags around code to make it a little easier for us.

file uri’s are odd

normally its file://host/path
but when host is “localhost” it can be omitted leading to file:///path

Thanks Norman - see, I saw the 3 slashes, and I THOUGHT it was weird, so I researched it, even going to RFC 1738 (“A file URL takes the form: file:///”) before I answered. Thanks for taking the extra step for me.

yer covfefe !

I think thats the right usage
Unless of course its a swear but then who knows :slight_smile: