Results 1 to 4 of 4
  1. #1
    jparker1954 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    85

    Use value of strField to populate the title textbox on a Report?

    OK, I got the code below to filter my report perfectly, thanks to help from some of you. Here's the problem. It filters the report fine, but there's nothing ON the report to say it's from Central Florida, New Jersey, or Outer Space for that matter. Is there any way to code the report so that a Text Box in the report will say Central Florida, New Jersey, etc. as applicable for the Report Title? Or am I asking too much?

    Sub PrintReports(PrintMode As Integer)
    On Error GoTo Err_Preview_Click
    ' This procedure used in Preview_Click and Print_Click Sub procedures.


    ' Preview or print report selected in the ReportToPrint option group.
    ' Then close the Print Sales Reports Dialog form.

    Dim strField As String

    Select Case Me.OptLoc
    Case 1
    strField = "Central Florida"
    Case 2
    strField = "New Jersey"
    Case 3
    strField = "North Carolina"
    Case 4
    strField = "North Florida"
    Case 5
    strField = "South Florida"
    End Select
    DoCmd.OpenReport "All-ChemInfo-Tomatoes", PrintMode, , "[" & strField & "]=True"
    DoCmd.Close acForm, "OpenReport"

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I'd have a zone table that listed all of these zones (the numeric value) and what they stood for (the text description) then link that to your table that stores the zone (number) value

  3. #3
    jparker1954 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    85
    I already have a table that shows the the Locations listed, but I don't know how to link it to select the right location on the report based on the strField that was used to filter the report. Ask me question about the Migrant Worker Protection Standard and I'm pretty good, but when it comes to code, I need visual help.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    the query driving your report, add the location table to that query, link it from your 'main' table to the locations table through the unique identifier and add the location descriptor field (south florida, north florida, etc) once it's added to that query you should be able to see it as an available field in your field list for the report then put it anywhere you want. (page header, report header, each row, etc)

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

Similar Threads

  1. Replies: 4
    Last Post: 11-14-2013, 04:23 PM
  2. report title
    By slimjen in forum Reports
    Replies: 4
    Last Post: 10-07-2013, 01:37 PM
  3. Auto Populate TextBox
    By Shido151 in forum Access
    Replies: 3
    Last Post: 04-23-2013, 10:41 AM
  4. Replies: 1
    Last Post: 02-04-2013, 09:48 AM
  5. Replies: 2
    Last Post: 04-27-2012, 06:28 PM

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