Hi John, What you say makes sense. I guess I am looking for a diagramatic way of presenting and event driven function. I am not imaginative and don't think "outside the square", but given a set of rules I can usually make them turn somersalts inside the square. I just thought there may a technique already established that I could use and would help my thought processes for ACCESS. Thank you again for everything
Ilona Adelaide, Australia -----Original Message----- From: ms_access@yahoogroups.com [mailto:[EMAIL PROTECTED] Behalf Of John Viescas Sent: Wednesday, 7 June 2006 7:37 AM To: ms_access@yahoogroups.com Subject: RE: [ms_access] On No Data Help Please Ilona- Flowcharts make sense in a batch sequential system, but not in the global scope of event-driven systems. I still build flowcharts for navigation between forms and for complex bits of code inside functions or event procedures. John Viescas, author Building Microsoft Access Applications Microsoft Office Access 2003 Inside Out Running Microsoft Access 2000 SQL Queries for Mere Mortals http://www.viescas.com/ (Paris, France) For the inside scoop on Access 2007, see: http://blogs.msdn.com/access/ -----Original Message----- From: ms_access@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ilona Wright Sent: Tuesday, June 06, 2006 9:15 PM To: ms_access@yahoogroups.com Subject: RE: [ms_access] On No Data Help Please Thank you John. That makes sense. As you can see, I am still trying to get my head around event driven code. This is probably another dumb question, but do you know of any books that help/teach users "flowchart" (if anybody does that anymore) event driven systems? In the old days I used to flowchart everything, and because I don't know ACCESS and have developed my system through trial and error basis, it is very "murky". All I can flowchart is bits of events, but that is not satisfactory. If this question is out of the scope of this list, I understand. Thank you again for helping me out. Ilona Adelaide, Australia -----Original Message----- From: ms_access@yahoogroups.com [mailto:[EMAIL PROTECTED] Behalf Of John Viescas Sent: Tuesday, 6 June 2006 4:28 PM To: ms_access@yahoogroups.com Subject: RE: [ms_access] On No Data Help Please Ilona- Your DoCmd.OpenReport is asking that a report be opened. Your code in the NoData event of the report discovers the report is empty, displays a message, and cancels the open. Your request to OpenReport hasn't finished when the NoData event runs. Because your code in NoData cancels the open, the code trying to do the OpenReport gets a 2501 Cancel error - it's the only way Access has to let the requesting code know that the OpenReport will fail. And if you think about it, you might want to do some other action in the code running the OpenReport if it is cancelled - and an On Error trap is the only way to do that. John Viescas, author Building Microsoft Access Applications Microsoft Office Access 2003 Inside Out Running Microsoft Access 2000 SQL Queries for Mere Mortals http://www.viescas.com/ (Paris, France) For the inside scoop on Access 2007, see: http://blogs.msdn.com/access/ -----Original Message----- From: ms_access@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ilona Wright Sent: Tuesday, June 06, 2006 1:47 AM To: ms_access@yahoogroups.com Subject: RE: [ms_access] On No Data Help Please Thanks for this John. I'm sorry, but I do not understand why I need he On Error BEFORE the DoCmd.openReport. The way I see it, the DoCmd.OpenReport is called from code in a form. The On No Data event is run in the report that was opened. I expect the the Cancel to close the report, pass control back to the calling form and continue with the next line of code. Is my thinking wrong? Maybe Cancel = True is the wrong statement for what I want to do. Thanks again Ilona -----Original Message----- From: ms_access@yahoogroups.com [mailto:[EMAIL PROTECTED] Behalf Of John Viescas Sent: Monday, 5 June 2006 5:22 PM To: ms_access@yahoogroups.com Subject: RE: [ms_access] On No Data Help Please Ilona- Add an error trap around your DoCmd.OpenReport. Setting Cancel = True creates a trappable 2501 error - your code canceled the action requested by the OpenReport. It could be as simple as: On Error Resume Next DoCmd.OpenReport ... John Viescas, author Building Microsoft Access Applications Microsoft Office Access 2003 Inside Out Running Microsoft Access 2000 SQL Queries for Mere Mortals http://www.viescas.com/ (Paris, France) For the inside scoop on Access 2007, see: http://blogs.msdn.com/access/ -----Original Message----- From: ms_access@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ilona Wright Sent: Monday, June 05, 2006 7:43 AM To: ms_access@yahoogroups.com Subject: RE: [ms_access] On No Data Help Please Hi John, In the On No Data event of my Computer Register report I have Private Sub Report_NoData(Cancel As Integer) MsgBox "There is no data for this report. Canceling report..." Cancel = -1 End Sub On pressing Enter to the MsgBox I get the error Run-time error '2501' The OpenReport action was cancelled. You used a method of the DoCmd object to carry out an action in Visual basic, but then clicked Cancel in a dialogue box. For example, you used the Close method to close a changed form, then clicked Cancel in the dialogue box that asks if you want to save the changes you made to the form. The Debug takes me to the DoCmd.OpenReport line that opened the report. If there is no data, how do I cancel the report and cleanly get back to my form? Thanks again in advance Ilona [Non-text portions of this message have been removed] Yahoo! Groups Links SPONSORED LINKS Microsoft access database Database development software Database management software Database software Inventory database software Membership database software ---------------------------------------------------------- -- YAHOO! GROUPS LINKS a.. Visit your group "ms_access" on the web. b.. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. ---------------------------------------------------------- -- [Non-text portions of this message have been removed] Yahoo! Groups Links [Non-text portions of this message have been removed] Yahoo! Groups Links [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> You can search right from your browser? It's easy and it's free. See how. http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/q7folB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ms_access/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/