Page 1 of 3 123 LastLast
Results 1 to 15 of 40
  1. #1
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99

    Open report on value of textbox

    Hi All, I have a report based on a select query. How could I open the report by clicking a button on a form and the criteria input dialog does not show up but automatically get the value of a textbox from the form?
    Should I use the wherecondition, or OpenArgs?
    I tried this but it didi not work.

    Private Sub Command2_Click()


    DoCmd.OpenReport "rptPartsList", acViewPreview, , , , OpenArgs:="Me.txtRepairID"
    End Sub

    Could somebody give any suggestion?

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The criteria row in the query would reference the control on the form.

    For more specific info, please post the SQL of the report query, the name of the form, the name of the control that you enter the number into and the name of the field that is filtered.

  3. #3
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    I made a sample db, please take a look.
    Thanks in advance.

  4. #4
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    https://www.accessforums.net/reports...ery-12307.html

    I opened another thread and it has already been solved.

  5. #5
    ahmad is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    18
    plz tell me code to open access report when enter text in textbox from form

  6. #6
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    It's something like this:

    Private Sub Command11_Click()
    DoCmd.OpenReport "rpt228-7Analyze", acViewPreview, , "RepairID='" & Me.RepairID.Value & "'"

    End Sub

    there's something you may reference to
    http://www.baldyweb.com/wherecondition.htm

  7. #7
    ahmad is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    18
    hi, blueraincoat. thanks 4 reply but plz solve my problem. i have make a form & take a button and textbox1. i wanna do that when i enter string("name" as table1 entry) in the textbox1 and click to button, then open report of same string as i entered in textbox1. in short, open report by taking text of textbox1.
    plz help me

  8. #8
    ahmad is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    18
    plz reply if anybody knows about it

  9. #9
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    you can add a command button click event to accomplish this,below is the code
    Private Sub Command_Click()
    DoCmd.OpenReport "rptYourReportName", acViewPreview, , "Name='" & Me.textbox1.Value & "'"

    End Sub

    if possible,you can post your db and maybe I can help you with it

  10. #10
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    I have another thread on the same issue,and Paul gave a very useful information that
    "If you still have a criteria in your query for this same value, you should take it out. The wherecondition argument of OpenReport replaces it."
    Hope this will help you out.
    https://www.accessforums.net/reports/...ery-12307.html

  11. #11
    ahmad is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    18
    thank you so much blueraincoat. one more problem is coming. when i enter 6 digit number in textbox1 according to field "idno" and click button, error is coming. plz help, if it will solve then there are no problem in my database. so plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz help.

  12. #12
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    If this filed is a numeric value you have to take off the single quote.
    http://www.baldyweb.com/wherecondition.htm
    Hope this help

  13. #13
    ahmad is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    18
    thank you blueraincoat.

  14. #14
    ahmad is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    18
    is it possible that access report open directly from vb6 button click?

  15. #15
    ahmad is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    18
    i mean, enter text in textbox and click button to open particular report directly.

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Filling in blank textbox on a report.
    By cowboy in forum Reports
    Replies: 3
    Last Post: 04-16-2010, 02:50 PM
  2. Report TextBox printing ID Number, not text
    By ZipDoc in forum Reports
    Replies: 8
    Last Post: 02-01-2010, 12:30 PM
  3. Replies: 2
    Last Post: 09-26-2009, 07:19 AM
  4. Keeping text in a report textbox
    By Hawkx1 in forum Reports
    Replies: 2
    Last Post: 11-13-2008, 04:11 PM
  5. Report will not print a bound textbox
    By vvrt in forum Reports
    Replies: 0
    Last Post: 03-16-2006, 02:16 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