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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » DAO form cannot be updated after printing report (A2K SR1)

    Author
    Topic
    #1771294

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #1794367

      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

      • #1794370

        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?

        • #1794371

          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.

          • #1794375

            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?

            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.

            • #1794376

              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.

    Viewing 0 reply threads
    Reply To: DAO form cannot be updated after printing report (A2K SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: