Solved

Object reference not set to an instance of an object

Posted on 2006-10-23
3
245 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 142

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
This is about my first experience with programming Arduino.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now