Results 1 to 5 of 5
  1. #1
    rbiggs is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    23

    Using Unbound text boxes

    I have a form with three unbound text boxes (txtDriverSelect, txtBefDate, txtEndDate) They filter the information on the form based on the user inputs. The problem I have is generating a report that reflects the same information. The report has a text box named DrverName. I have a onClick cmd on the Form to open the Report with the following in the where condition. But the report opens up blank. Does the txtboxes on the Report need to be unbound as well.



    [Reports]![MileageReport]![DrverName]=[Forms]![DriverMileage]![txtDriverSelect]

    Thanks

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    if you're gonna use a WHERE condition in an OPENREPORT action, it has to be syntax similar to this:

    Code:
    "[field] = '" & [Forms]![DriverMileage]![txtDriverSelect] & "'"
    or for numerical values:


    Code:
    "[field] = " & [Forms]![DriverMileage]![txtDriverSelect]
    Or you can throw them manually into the report after you open it. Note that the WHERE condition of OPENREPORT does not apply to unbound controls, because it's a filtering mechanism for the underlying source dataset.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    In VBA code the syntax look like:

    BaldyWeb wherecondition

    I think in a macro you still only want the field name in the first part, but in truth I don't use macros. Whether the form textboxes are bound or not should not affect the operation of a wherecondition. On the report side, you're referring to a field in the underlying data, not a textbox on the report.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    rbiggs is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    23
    I put this in the Click event:

    Private Sub Milage_RPT_Click()
    DoCmd.OpenReport "Mileage Report", acViewReport, , "[Driver Name] = '" & Me.txtDriverSelect & "'"
    End Sub

    The other part of the form uses dates to narrow down the results. On the Mileage Report I have the field name corresponding to table where the dates are stored. How can I reference these in the where condition since they both have the same field name.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm not sure I understand. Are you saying the date field has the same name? Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  2. Unbound Text boxes
    By kyleg222 in forum Forms
    Replies: 2
    Last Post: 08-02-2011, 12:53 PM
  3. Replies: 0
    Last Post: 05-03-2011, 05:58 AM
  4. Apply Filter based on unbound date boxes
    By anoob in forum Access
    Replies: 3
    Last Post: 01-21-2011, 05:26 PM
  5. Use unbound boxes in a form
    By jjerome512 in forum Forms
    Replies: 2
    Last Post: 01-14-2010, 08:53 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