• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 71
  • Last Modified:

Acces 97 in 2010 Error

We have a client that tried using an access DB that was created in 97 with Access 2010.  Everything seems to be working except the reports it should generate.  we keep getting Compile error:  Method or data member not found and it points the code below.  What can I do to correct this?

Private Sub Button5_Click()
    Dim db As Database: Set db = CurrentDb()
    Dim wkspace As Workspace: Set wkspace = DBEngine.Workspaces(0)
    Dim rsControl As Recordset

    ' gets the user input date interval for the report period
    Set rsControl = db.OpenRecordset("tblControl", DB_OPEN_DYNASET)
        rsControl.SummaryStartDate = Me!FromDate
        rsControl.SummaryEndDate = Me!ToDate

    Select Case (Me!RptType.Value)
      Case 1
        If Me!Option1 = False Then
          DoCmd.OpenReport "rptSalesSummarySum", A_PREVIEW
          DoCmd.OpenReport "rptSalesSummarySumH", A_PREVIEW
        End If
      Case 2
        If Me!FromDate <= rsControl.ArchivedDate Then
            DoCmd.OpenReport "rptHourlySummaryA", A_PREVIEW
          If Me!Option1 = False Then
            DoCmd.OpenReport "rptHourlySummary", A_PREVIEW
            DoCmd.OpenReport "rptHourlySummaryH", A_PREVIEW
          End If
        End If
      Case 3
        DoCmd.OpenQuery "qryMenuItemSales_IndStore"
      Case 4
        DoCmd.OpenQuery "qryMenuItemSales_AllStores"
      Case 5
        DoCmd.OpenReport "rptDailyMessages_IndStore", A_PREVIEW
      Case 6
        DoCmd.OpenReport "rptDailyMessages_AllStores", A_PREVIEW
      Case 7
        If Me!Option1 = False Then
          DoCmd.OpenReport "rptDailyDeposit_Cur", A_PREVIEW
          DoCmd.OpenReport "rptDailyDeposit", A_PREVIEW

        End If
      End Select

End Sub

Open in new window

1 Solution
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Dim rsControl As Recordset>>

 You need to check the references in VBA.   Your using DAO, not ADO so you need a reference for that (it's the one labeled "Office 14 Database Engine Objects" I believe - seems I can never remember it right without looking).

 Also look for any that are missing or broken.

Starting with A2007, Access is quite a bit picker about syntax as well.  What line was it pointing to?

acasgarAuthor Commented:
Thats already selected and the debug is going to rsControl.SummaryStartDate = Me!FromDate in particutlar it is pointing at .SummaryStartDate
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
had a funny feeling. Change it to:


  You'll have to change all the syntax like that if it's done that way (which it appears it is).

 Use of a dot ("."), means your referning to a method or property of an object.  You could get away with it in the past, but no longer.

 Where it gets really confusing is that the old syntax for refering to a control was:


 and now can be done with:


  as the controls collection is the default collection for a form, and forms also have the added twist of making controls into a property internally, so the dot syntax works.

 There are times though when it doesn't, so I like to stick to the old style syntax:

Dot is for method or property
Bang is for something in a collection (like a field or control).

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

acasgarAuthor Commented:
I've requested that this question be deleted for the following reason:

no good answer was given
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Did you try changing the syntax?  If so, it didn't work?

The answers you were given are correct.  Microsoft tightened up a lot of internal stuff in Access in 2007 and 2010 and some of the things you could get away with in the past simply don't work as they do now.

Be that aside, simply coming back with "no good answer given" doesn't help anyone in the future reading this.


Your code looks fine, but what information does the debugger shows you when you put a breakpoint in your code? Are all objects set?

Can you attach a copy of the database application?

What have you done so far?

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now