Adding items from another query in a form

Discussion in 'Microsoft Access Queries' started by Jasper Recto, Jul 25, 2008.

  1. Jasper Recto

    Jasper Recto Guest

    I have a continuous form (frmProduction) that was created from the query
    qryLabor.

    I have another query called qryLaborSum that uses the qryLaborCosts to sum
    up a few fields so I can get the total cost.

    I want to add the qrylaborSum information on the footer of the frmProduction
    form without using a subreport.

    How would I do that?

    Thanks,
    Jasper
     
    Jasper Recto, Jul 25, 2008
    #1
    1. Advertisements

  2. I assume you want only a single value; the sum? If so, then I'd say do it in
    code in the form's Current event:

    Private Sub Form_Current()
    Dim db As Database
    Dim rs As DAO.Recordset
    Dim strSQL As String

    strSQL "SELECT * FROM qryLabourSum WHERE somefield = " & Me!txtsomefield

    Set db = CurrentDb
    Set rs=db.OpenRecordset(strSQL,dbOpenSnapshot)
    Me!txtSum = Nz(rs!SumOfLabourCosts, 0)

    rs.Close
    Set rs = Nothing
    Set db = Nothing
    End Sub

    Regards,
    Graham R Seach
    Microsoft Access MVP
    Sydney, Australia

    "Jasper Recto" <> wrote in message
    news:%...
    >I have a continuous form (frmProduction) that was created from the query
    >qryLabor.
    >
    > I have another query called qryLaborSum that uses the qryLaborCosts to sum
    > up a few fields so I can get the total cost.
    >
    > I want to add the qrylaborSum information on the footer of the
    > frmProduction form without using a subreport.
    >
    > How would I do that?
    >
    > Thanks,
    > Jasper
    >
     
    Graham R Seach, Jul 27, 2008
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest

    Query Using a Form and another Query

    Guest, Jul 7, 2005, in forum: Microsoft Access Queries
    Replies:
    3
    Views:
    150
    Guest
    Jul 7, 2005
  2. Ivan R via AccessMonster.com

    Form based on query used to open another form.

    Ivan R via AccessMonster.com, Dec 1, 2005, in forum: Microsoft Access Queries
    Replies:
    0
    Views:
    135
    Ivan R via AccessMonster.com
    Dec 1, 2005
  3. Guest

    Adding data from one query to another query

    Guest, Jan 18, 2006, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    159
    Marshall Barton
    Jan 18, 2006
  4. Guest
    Replies:
    2
    Views:
    219
    Guest
    Jan 20, 2006
  5. PaulSchrum
    Replies:
    3
    Views:
    2,334
    PaulSchrum
    Feb 15, 2011
Loading...

Share This Page