1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Database not working properly on another computer

Discussion in 'Software Development' started by bilotbear, May 26, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. bilotbear

    bilotbear Thread Starter

    Joined:
    May 26, 2010
    Messages:
    2
    I recently made a simple database with Access 2007. Problem is that when I transferred the database to the user's laptop, my report generating code suddenly doesn't work. I copied that database to my flash drive to fix it on my computer but when I ran it, it works perfectly fine. This really puzzled me. :(

    The report generating code goes something like:

    str = "Select Table.Field1, Table.Field2....."

    DoCmd.OpenReport "Reportname", acViewReport
    Report![Reportname].Recordsource = str

    The code works fine up to returning the str variable. I've checked and it returns the correct query. But then, the str query doesn't stick to the report's recordsource. The report opens up with it's original recordsource but what I need is the filtered recordsource that's supposed to be returned by the str query.

    Any thoughts?
     
  2. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    bilotbear, welcome to the Forum.

    You would have had a much quicker response to your question if you has posted on the Business Applications Forum, as most Access/Excel programmers don't check this forum very often.
    The best way to ensure that your Report gets the correctly filtered query is to use the Querydef function to replace the query that the Report uses with the filtered version.
     
  3. bilotbear

    bilotbear Thread Starter

    Joined:
    May 26, 2010
    Messages:
    2
    Thanks OBP. :) I'll familiarize myself more with the thread categories here in Tech Support Guy as I search for more solutions.

    About my problem. I found out that the query was working however, it wasn't being displayed on the report view. I accidentally found this out when I viewed the generated report in print preview. Even though the data in the report view was wrong, it appeared correct when I viewed it in print preview. So what I do now is ask the user to always view it in print preview after it was generated in report view.

    It's just a work around though. I'll explore working with the Querydef just like you said.

    But it still puzzles me why Access works this way. :/
     
  4. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    I am afraid Access and Access VBA are full of little surprises like that, but usually there is a work around.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/925349