J
Joy M
Hi -
Is it normal to pass an instantiated Database as a Function parameter? For
example, as
Function Update_PolicyTable (db as Database, intInvoicePolicyNo as integer)
The reason why I want to do it is that I instatiate the database in my main
loop, and
open all the recordsets there. Then I call a function that has this code
Dim db as Database
Dim rec as Recordset
Dim strSQL as String
strSQL = "SELECT * FROM tblPolicy WHERE polPolicyNo = " intInvoicePolicyNo
Set db = CurrentDb()
Set rec = db.OpenRecordset(strSQL, dbOpenDynaset)
This code is based on an example in my book that I want to modify.
I want to use strSQL, thus I need to dim the rec.
But do I need to dim the db also, or do I just pass it as a function
parameter?
(This is my first time using DAO and it is hard to get my head around doing
something beyond the examples in the book!)
Thanks!!
Joy
Is it normal to pass an instantiated Database as a Function parameter? For
example, as
Function Update_PolicyTable (db as Database, intInvoicePolicyNo as integer)
The reason why I want to do it is that I instatiate the database in my main
loop, and
open all the recordsets there. Then I call a function that has this code
Dim db as Database
Dim rec as Recordset
Dim strSQL as String
strSQL = "SELECT * FROM tblPolicy WHERE polPolicyNo = " intInvoicePolicyNo
Set db = CurrentDb()
Set rec = db.OpenRecordset(strSQL, dbOpenDynaset)
This code is based on an example in my book that I want to modify.
I want to use strSQL, thus I need to dim the rec.
But do I need to dim the db also, or do I just pass it as a function
parameter?
(This is my first time using DAO and it is hard to get my head around doing
something beyond the examples in the book!)
Thanks!!
Joy