Solved

Object reference not set to an instance of an object

Posted on 2006-10-23
3
249 Views
Last Modified: 2010-04-16
Getting object refernce errors with the following code. The code breaks at tmpbuild = dbsmain.OpenRecordset("Buildings", DAO.RecordsetTypeEnum.dbOpenDynaset)
  dbsmain is declared in a module. any help appreciated.

Dim tmpbuild As DAO.Recordset

        Dim buildtofindtext As String
        Dim buildid As Integer
        Dim plan As DAO.Recordset
        Dim rsurv As DAO.Recordset
        Dim surveytext As String
        Dim plantext As String
        tmpbuild = dbsmain.OpenRecordset("Buildings", DAO.RecordsetTypeEnum.dbOpenDynaset)
        rsurv = dbsmain.OpenRecordset("Surveys", DAO.RecordsetTypeEnum.dbOpenDynaset)
        plan = dbsmain.OpenRecordset("Plans", DAO.RecordsetTypeEnum.dbOpenDynaset)

0
Comment
Question by:summers_IT
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 17787577
where do you set the object "dbsmain" in your code?
you say "declared", how? and how is is initialized?

Note that anyhow, you need to use SET to assign a recordset object to the variable:

set        tmpbuild = dbsmain.OpenRecordset("Buildings", DAO.RecordsetTypeEnum.dbOpenDynaset)
set        rsurv = dbsmain.OpenRecordset("Surveys", DAO.RecordsetTypeEnum.dbOpenDynaset)
set        plan = dbsmain.OpenRecordset("Plans", DAO.RecordsetTypeEnum.dbOpenDynaset)
0
 

Author Comment

by:summers_IT
ID: 17787646
Thanks,

Your reply has helped me sort this out. I had initialized dbsmain in another window ,both these windows are in a frameset and the window in which in initialized had a parser error.

Thanks for the help, I'm sure I will be back with more questions soon.

Regards,
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 17787686
How is dbsmain declared, and where is it assigned (actaully give a value)?

AW
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question