Results 1 to 3 of 3
  1. #1
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071

    Run a query with a parameter based on a subform textbox


    I'm using MS Access 2010 and I'm having an issue with a Report. The Query for the Report includes 2 Parameters that are based on unbound textboxes on the Reports Page of my Database. I'm using the Navigation Control so the syntax is Between [Forms]![mainmenu]![NavigationSubform].[Form]![txtstart] And [Forms]![mainmenu]![NavigationSubform].[Form]![txtEnd]

    But for some reason Even though I've verified I put in dates in those two fields they are coming back blank. I tried creating global variables called dtstart and dtend and then in the after updated event for each text box setting those two variables = to the start date and end date but the query still prompts me for dtstart and dtend. I know I've done this before but apparently I've forgotten a step and no idea where to proceed to get the date range into my query. Help!!!!!!!!!!!!!!!!!!!!!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    The form controls should work, presuming that's the correct spelling and syntax (I haven't used a Navigation form). The global variables won't work, they aren't known outside VBA. The workaround to that is creating a public function that returns the value of the variable, and using that in the query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Oh, and make sure you've hit tab or enter after entering a date in the form textbox, or it's value won't be seen by the query. Mistake I've made a number of times while testing.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Passing a Form Textbox to a query parameter
    By NickWren in forum Access
    Replies: 2
    Last Post: 06-28-2016, 08:43 AM
  2. Passing textbox value into sql query parameter
    By gustavoavila in forum Access
    Replies: 7
    Last Post: 04-23-2014, 04:00 PM
  3. Query with parameter from Form Textbox
    By Juan4412 in forum Queries
    Replies: 1
    Last Post: 07-10-2013, 02:33 PM
  4. Replies: 20
    Last Post: 03-05-2012, 04:56 PM
  5. Replies: 3
    Last Post: 02-10-2010, 07:29 AM

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