开发者

Visual Basic declaration question

开发者 https://www.devze.com 2022-12-19 17:19 出处:网络
I\'m attempting to declare DAO variables in VB, but when I go to assignment statements, it says they must be declared. But I\'ve just declared them in the line above! What\'s开发者_运维知识库 going on

I'm attempting to declare DAO variables in VB, but when I go to assignment statements, it says they must be declared. But I've just declared them in the line above! What's开发者_运维知识库 going on?

Code:

 Public Class frmBaseForm

     Public acDb As dao.Database
     Public acRs As dao.Recordset

     acRs = acDb.OpenRecordset("Something")

 End Class

acRs shows up as undeclared in the last line.


Public Class frmBaseForm

    Public acDb As dao.Database
    Public acRs As dao.Recordset

   Public Sub ArbitraryEvent()
    acDB = New dao.Database
    acRs = acDb.OpenRecordset("Something")
   End Sub
End Class

Or something like that


You must first add the Dao object library in your project(that's just in case you haven't done so yet).

0

精彩评论

暂无评论...
验证码 换一张
取 消