Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Report Record Source Doesn't Work for Current Year (2003)

    I use the following code to set a Report Record Source during run time but it doesn't work for 2006 in spite of the fact there are data present for that year.
    I've tried to whittle the mdb down as much as possible using decompile also but I can only get it to 170kB so you can find the file here .
    On the startup form please select December 2005 and click the REPORT button, you'll see the report opens normally while it doesn't if you select January 2006.
    <pre>Private Sub Report_Open(Cancel As Integer)
    Dim strNewRecord As String
    strNewRecord = "SELECT OreP.NOME, OreP.mese, OreP.anno, OreP.ore, ProdEnTotMp.[" & _
    [Forms]![MSeleData]![Mese] & "] as Olm, ProdEnSGBp.[" & [Forms]![MSeleData]![Mese] & "] as SGB, ProdEnPap.[" & _
    [Forms]![MSeleData]![Mese] & "] as PAC, ProdEnPpp.[" & [Forms]![MSeleData]![Mese] & _
    "] as PPI FROM OreP, ProdEnTotMp, ProdEnSGBp, ProdEnPap, ProdEnPpp " & _
    "WHERE OreP.mese=[forms]![mseledata]![mese] AND OreP.anno=[forms]![mseledata]![anno]"

    Me.RecordSource = strNewRecord
    End Sub</pre>


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report Record Source Doesn't Work for Current Year (2003)

    There are records for Gennaio 2005, not for Gennaio 2006. Something seems to have gone wrong in the OreP table, for some months are stored as numbers, others by name.

    Your database is heavilly corrupt - see the numerous "lost" objects in the Visual Basic Editor. And the module for MSeleData contains lots of unused code.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report Record Source Doesn't Work for Current Year (2003)

    You're right Hans, I should have imported all the objects into a new database once I deleted all the unnecessary ones from a copy of the original mdb.
    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •