Results 1 to 3 of 3
  1. #1
    jgelpi16 is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544

    Question Advance to next row in report

    I am generating a report and having to assign the values to the report programmatically. The report is bound on dates and it has a list of dates from the same table that my recordset is based on. I have included the beginning of my code to give you an idea. However, when the report loads the first value that was assigned to the text box is displayed in all of the text boxes for the "No Response" category. How can I either advance to the next text box within the report? Is this something that is feasible? I have included screen shot of report for reference as well. Thanks in advance for your help.



    Code:
    Private Sub Report_Load()
        Dim db As DAO.Database
        Dim rs As DAO.Recordset
        Dim varDiv, varDate, varResponse, varCount
        
        Set db = CurrentDb
        Set rs = db.OpenRecordset("qryDivBreakdown", dbOpenDynaset)
        rs.MoveFirst
        Do While Not rs.EOF
        '******************
        'This loop will look up each value in "qryDivBreakdown
        'and assign the value to the appropriate box within rptDivBreakdown
        '******************
            varDiv = rs("DIVISION")
            varDate = rs("BegWk")
            varCount = rs("CountID")
            varResponse = rs("Response")
            If varDiv = 10 Then
                If varResponse = "No Response" Then
                    txtDiv1_7.Value = varCount
                End If
            End If
                    
        rs.MoveNext
        Loop
    End Sub

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    mmmm don't like the approach. I believe you can (and should) establish all needed values at the core record set; via calculated values. Even if it means subqueries.

    I didn't look into it that deep though, are you sure that you can not?

  3. #3
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    I created a 'Timesheet' type of report similar to look with your snapshot. On the Report itself, I had each field/control separately (versus a query). So I had 50 controls on the report. For example, I had controls named "Text1", "Text2", "Text3", etc.. I would then loop in code (in the OnFormat of the report detail section) populating each of these controls using a loop along with the recordset I opened.

    ex:
    For X = 1 to 50
    me.controls("Text" & X).value = rs!Field(X) (where rs is the recordset I opened to loop through)
    next X

    I'm not sure if this helps but it's one approach. The other approach which I think is best for your report is to design a query (you could use expressions for some fields) which returns the date range and values. Or you could write some code to create a temporary type table and populate it. The report would then just be based on this table or a query.

    (nice looking report)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 12-13-2010, 05:33 PM
  2. advance date reminder
    By Denis in forum Database Design
    Replies: 1
    Last Post: 11-14-2010, 07:40 AM
  3. Advance Report Help
    By OldCityCat in forum Reports
    Replies: 1
    Last Post: 09-18-2010, 07:58 AM
  4. Replies: 3
    Last Post: 05-21-2010, 03:57 PM
  5. Replies: 3
    Last Post: 02-19-2010, 04:19 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums