From: paul bennett on 4 May 2010 11:27 I have several queries opening from a single command button. The first should be: DoCmd.OpenQuery DELETEtbldatentry I get an error message telling me "DELETEtbldatentry = empty" the query name is correct (including case) and the query opens and runs fine when opened manually. What am I doing wrong?
From: Jeff Boyce on 4 May 2010 11:40 Paul Please provide a bit more context in which this line of code is being executed... Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "paul bennett" <paulbennett(a)discussions.microsoft.com> wrote in message news:D559C11F-0919-40D9-8323-D5F1B8D45471(a)microsoft.com... >I have several queries opening from a single command button. The first >should > be: > > DoCmd.OpenQuery DELETEtbldatentry > > I get an error message telling me "DELETEtbldatentry = empty" > the query name is correct (including case) and the query opens and runs > fine > when opened manually. > > What am I doing wrong?
From: Stuart McCall on 4 May 2010 12:39 "paul bennett" <paulbennett(a)discussions.microsoft.com> wrote in message news:D559C11F-0919-40D9-8323-D5F1B8D45471(a)microsoft.com... >I have several queries opening from a single command button. The first >should > be: > > DoCmd.OpenQuery DELETEtbldatentry > > I get an error message telling me "DELETEtbldatentry = empty" > the query name is correct (including case) and the query opens and runs > fine > when opened manually. > > What am I doing wrong? Because DELETEtbldatentry is the name of a query, VBA just interprets it as a string of characters (which it is) and incorrectly assumes it's a variable. You need to surround it with quote marks so VBA can interpret it as the name of a query, which is what OpenQuery is expecting. DoCmd.OpenQuery "DELETEtbldatentry"
|
Pages: 1 Prev: not recognising a query Next: Controlling fields in continous subforms (hunting for ideas) |