Results 1 to 2 of 2

Thread: Help newnie: using grouping and select at the same time

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    2

    Help newnie: using grouping and select at the same time

    Hi,

    I have data in an access database that I wish to output in a VB6 report
    depending on certaine dates (if a record data_field is not in the range, it
    should be excluded)

    Imanaged to do that by writing the code (see below) by hand (or using a stored procedure).

    However, I also want to use the grouping feature of VB6 which I cannot get
    to work with the above code as only detail section accepts information.


    Is there a way to get both to work ?
    VB Code:
    1. Private Sub mnureport_Click()
    2.  
    3. Dim cn As Connection
    4. Dim rs As Recordset
    5. Dim dv1 As Variant
    6. Dim dv2 As Variant
    7.  
    8. Set cn = New Connection
    9. cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and
    10. Settings\Administrator\Desktop\TobaccoCardPerso\TCP.mdb;Persist Security
    11. Info=False"
    12.  
    13. dv1 = DateValue("05/10/2003")
    14. dv2 = DateValue("05/20/2006")
    15.  
    16. Set rs = cn.Execute("SELECT * from TCP WHERE Date BETWEEN #" & dv1 & "#
    17. AND #" & dv2 & "# ORDER By last_name")
    18.  
    19.  
    20. Set DataReport1.DataSource = rs
    21. DataReport1.Show
    22.  
    23. End Sub

    Regards,

    Philipe



    Edit: Added [vbcode][/vbcode] tags for clairty. - Hack
    Last edited by Hack; Sep 7th, 2005 at 08:32 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width