Visual Basic declaration question
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).
精彩评论