Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003

    Unanswered: VB, Queries,a and Sql - OH MY, help writing a script...

    Hey everyone, looking for a little help with access/VB

    Here's the situation.....
    I have a database that tracks what people in my organization are working on. The user enters their name and several other generic things....then enters a number of "tasks" they did in a day, up to 6. With each task, a release number, segment number(Which is a way to break down the release) and hours worked associated with that release and seg number, so for example we have...


    up to 6

    What I am attempting to do is make a query then a report, via a table that will query all six tasks for a particular release.

    Here's the part that gets sticky....

    If that Release is there, I need to take the hrs that are associated with that task and add them to a running total of segment numbers for that particular release.

    In other words, today I worked on 4 tasks

    task1 would be as follows
    hrs = 2
    Release = Mac
    segnum = Design

    hrs = 3
    Release = MAC
    segnum = Fabrication

    hrs = 4
    Release = Mac
    segnum = Design

    So what I need the query/vb script to do is say I'm looking for any record associated with "Mac" So it finds "Mac" and says ok....well there are two records, then it totals the time and segment numbers and says on the Release "Mac" there was a total of 6 hrs spent on design and then 3 on Fabrication.

    Does anyone follow me?

    I have worked with C and C++ and I can beat my way through VB but I don't know the syntax that well and I don't know the variable prefixes to make the form/access relations work. Don't even know if I should be using something like SQL...

    I'm really hoping for some help.....anything would greatly appreciated.....


  2. #2
    Join Date
    Dec 2003
    Toronto, Ont. Canada

    Smile Re: VB, Queries,a and Sql - OH MY, help writing a script...

    Hello macgyver007...

    Access provides you with the capability of adding Grouping levels to the recordset for a report...

    There are lots of ways you could do this... You could do a separate query for this... and/or use an SQL statement in code to create the recordset for the report...

    However, I would simply use the table itself as the recordsource, and then add two Grouping and Sorting levels... First I'd group and sort on Release and then on Segnum... To get the totals onto the report you can use the Running Sum properties of text box controls to sum the hours for each group (in the Group Footers)... In effect it's just control break stuff that happens when the report is opened/printed...

    Look up Grouping Reports in Access Help and post back if you want more specific assistance...


Posting Permissions

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