Visual Basic in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am writing a visual basic procedure as follows:

Public Sub DaysAvg()
'Calculate the average value of a given value.

Dim dbs As Database

Dim rst As DAO.Recordset
Dim varBookmark As Variant
Dim numAve, numDaysAvg As Number
Dim intA, intB, lngCount As Integer

Set dbs = CurrentDb

'Open Table
Set rst = dbs.OpenRecordset("SGX Individual Historical", dbOpenTable)

rst.MoveFirst

Do While Not rst.EOF
intA = 1
intB = 0
varBookmark = rst.Bookmark
" I will not enclose the full code as it too long"


When i debug the code, the 2nd statement encounter problem. I follow exactly
what written in the book but visual basic seem like dun recongise (Dim dbs As
Database)

Please help!!!

Thank you.

Nelson Chou
 
Back
Top