Hello-
I have a Private sub (code behind a form) that I would like to call to a sub within the same form. The code abbreviated is as follows:
Option Compare Database
Private Sub Form_Open(cancel As Integer)
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim rst2 As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("MainQuery2")
Call getdata
end sub
Public sub getdata()
'gathers all fields needed for Private Sub
end sub
When I place the rst open statement in either sub it doesn't see it and so an 'object not found' error occurs.
I have a Private sub (code behind a form) that I would like to call to a sub within the same form. The code abbreviated is as follows:
Option Compare Database
Private Sub Form_Open(cancel As Integer)
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim rst2 As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("MainQuery2")
Call getdata
end sub
Public sub getdata()
'gathers all fields needed for Private Sub
end sub
When I place the rst open statement in either sub it doesn't see it and so an 'object not found' error occurs.