• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 66
  • 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.Edit
    rsControl.Edit
        rsControl.SummaryStartDate = Me!FromDate
        rsControl.SummaryEndDate = Me!ToDate
    rsControl.Update

    Select Case (Me!RptType.Value)
      Case 1
        If Me!Option1 = False Then
          DoCmd.OpenReport "rptSalesSummarySum", A_PREVIEW
        Else
          DoCmd.OpenReport "rptSalesSummarySumH", A_PREVIEW
        End If
      Case 2
        If Me!FromDate <= rsControl.ArchivedDate Then
            DoCmd.OpenReport "rptHourlySummaryA", A_PREVIEW
        Else:
          If Me!Option1 = False Then
            DoCmd.OpenReport "rptHourlySummary", A_PREVIEW
          Else
            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
        Else
          DoCmd.OpenReport "rptDailyDeposit", A_PREVIEW

        End If
      End Select

End Sub

Open in new window

0
acasgar
Asked:
acasgar
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
<<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?

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

 rsControl![SummaryStartDate]

  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:

 Me![FromDate]

 and now can be done with:

 Me.FromDate

  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).

Jim.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

no good answer was given
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
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.

Jim.
0
 
DSTECH_ADMIN_01Commented:
acasgar,

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?

Danny
0
 
MacroShadowCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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