Access 2000 - Declaring a DB object in VBA

J

John

I am trying to write a function which will load a "rules
array" from the current database the first time the
function is called in a query. The rules table is much
more complicated that it looks here. I tried to keep
simple for first trial.

The CAPS line (DIM MYDB AS DATABASE) give me an error:
user-defined type not defined

I am sure I am missing something simple. Any help
appreciated.

Code snipet follows-------
Global buildtypearray As Boolean
Global typearray(20) As Integer

Public Function CalcDue(AdvanceType As Integer, Advance As
Double, FundDate As Variant, SettleDate As Variant,
PaidDate As Variant) As Double
If buildtypearray Then
Else
DIM MYDB AS DATABASE,
Dim mydataset As Recordset, myqry As String
Set myqry = "select fundingtype, maxmultiple from
dbo_fundingtype_parms;"
Set mydb = CurrentDb
Set mydataset = mydb.openrecordset(myqry)
Do Until rst.EOF
i = mydataset(fundingtype)
typearray(i)= mydataset(maxmultiple)
mydataset.MoveNext
Loop
End If
buildtypearray = True
'etc
End Function
 
S

Steve Schapel

John

In your VB editor, go to Tools|References menu, and set a reference to
Microsoft DAO 3.6 Object Library.
 
J

John

Solved this problem by adding DOA Object Library
Tools - References - <select DOA 3.51>

Thanks anyway. I am now having a different problem. lol

John
 
J

john

Thanks Steve, As you might have noticed I realized that
was not set just before you replied. However, thanks
again! Everything I needed to do is now working!!!

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top