make database availble to othe actions

I have associated the following code with an action on a pushbutton and it seems to work. the purpose of this is to allow the user to select a database. How can I make the database available to other action events associated with a different pushbutton?

[code] //Get the file name
Dim f as FolderItem
Dim dlg as new OpenDialog
dlg.Title = “Open *.sqlite File”
f = dlg.ShowModal()

	//Connect to a SQLite database
	Dim db as new SQLiteDatabase
	db.DatabaseFile = f
	
	If db.Connect = True then
			'The connection was successful!
	Else 'It did not connect
			MsgBox "An error occured connecting to the database" + EndOfLine +_
			db.ErrorMessage
			return
	End If[/code]

delete the Dim db as new SQLiteDatabase
make a property “db” as sqlitedatabase in the window class

You might want to start with the Introduction to Programming Textbook
It’s free, and will get you started with programming, covering the basics for using Xojo.

From there, you can work through the manual that you’ll find in the Documentation folder of your Xojo install.

Thanks,

I will do as you suggest.