Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Location
    Canada
    Posts
    25

    Unanswered: VBA with a Query row by row evaluation, like you can with a report, possible?

    I'm trying to work on printing off some time reports from a security system. There's an events table where someone is either coming in or going out. I have setup a report with some vba code under the

    Private Sub Detail_Print which evaluates if the person is coming or going and then does a timeDiffSec = DateDiff("s", gateInTime, gateOutTime) to find out the difference and adds it to a counter.

    The problem is it's seeming to get more and more complicated and I can get some of the right data but it's not printing out nicely.

    So my idea was well maybe I should do the datediff as a new query and just store that value then it'd be pretty easy to run the query. But using a small sample data of 27 events 14 comings 13 goings when I try to make a query I get 31 values returned.

    So is there anywhere to attach vba code to a query or am I attacking this wrong.

  2. #2
    Join Date
    Sep 2004
    Location
    Tampa, FL
    Posts
    520
    You can put SQL in the VBA but not the other way around that I know of.

    In my experience ( limited ) when my query returns an unexpected amount of records I used the wrong kind of JOIN in my SQL.

    That's really a 1.5 Cents worth.
    Darasen

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    sounds like you were on the right track the first time.

    Elaborate on:

    The problem is it's seeming to get more and more complicated and I can get some of the right data but it's not printing out nicely.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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