Results 1 to 6 of 6
  1. #1
    Autumn
    Guest

    DAO form cannot be updated after printing report (A2K SR1)

    I have a form which displays one row at a time of a table. In the form there are navigation controls as well as a command control which print information of the row in display with the code:

    DoCmd.OpenReport "rptReportName", acNormal, , strFilter

    where rptReportName is the name of the report which formats the output of the displayed row.

    Whenever I execute the print command button, the report is printed as expected. However, my form cannot be updated after printing and all my other command controls refuse to work except to close the form using the Close button of the form.

    What is the cause that makes my form un-updatable? I'm using DAO objects.

  2. #2
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Wellington, New Zealand
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DAO form cannot be updated after printing report (A2K SR1)

    When you say that all your other controls 'refuse to work' what exactly is happening with them? Are they just not responding (i.e you click them and nothing happens) or are they giving an error message?

    If they are giving an error message, what is the message and is it the same for each control.

    What are your other controls trying to do (ie. what code sits behind them?).

    Cheers

    Jayden

  3. #3
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DAO form cannot be updated after printing report (A2K SR1)

    The other command buttons on the form are navigation buttons, Search, and Close buttons (containing plain DoCmd.Close). They failed to respond after printing but were responding as expected if the Print button wasn't executed. I can display my listbox and combobox on the form, but I can't update the fields. I can't change the values in my textboxes. Have I done anything wrong?

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: DAO form cannot be updated after printing report (A2K SR1)

    It sounds like your form is filtered down to a single record, so there shouldn't be anyplace for navigation buttons to take you. I thought you said the close button worked after printing, did I misunderstand? I'd suggest you post the entire sub from the Print button event procedure so we can see if there is something in it that is causing you problems. Is there any code behind the report itself? If so, we need to see that as well. Also, are there any subforms involved here? If so, do you have any code that locks the subform control? That will certainly make it impossibly to edit unless you unlock it again.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DAO form cannot be updated after printing report (A2K SR1)

    When I read your reply, Charlotte, it immedately hit me that you had gotten to the root of the problem! My Print command button prints the current record (record on display), and I used SQL to narrow it down to a single record before sending it to the report. I re-issued the SQL after I hit the Print button, and everything is back to normal. Thanks a lot, Charlotte. Why it had never dawned on me that I had filtered the table down to a single record? [img]/forums/images/smilies/smile.gif[/img]

    BTW, is there a simple method with DoCmd that I can use to print the current record without resorting to SQL?

    I was a little hesitant to send my sub over because all my user's variable anmes, sub names, messages etc were written using the local native language, or a combination of English and the native language, and they may appear odd to you without editing. I will send one over next time if there is a necessity. Thanks.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: DAO form cannot be updated after printing report (A2K SR1)

    You can use DoCmd.OpenReport and pass it a WhereCondition that includes the values you used to filter your form down. The syntax can be found in Help or in the Object Browser in the VBE. That way, the report will open with only that record in its recordset. However, you don't need the report bound to a parameter query for these purposes.
    Charlotte

Posting Permissions

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