Create a SQL Passthrough prompt

Posted on 2006-05-18
Last Modified: 2010-05-18
I would like to write my SQL passthrough qry to prompt the user to enter in a date value.
I know how to write it using SQL +, but not in SQL which is how MS Access passthrough reads the code.

Any suggestions or how to?

Question by:GarDog17
    1 Comment
    LVL 44

    Accepted Solution

    SQL+ ??  :-S

    You'll have to do it in code.  Altering the SQL of the passthrough before using it.
    Something like

    Dim varDate

    varDate = InputBox("Please Enter Date")

    If Not Isnull(varDate) Then
        CurrentDb.QueryDefs("YourPassthroughName").SQL = "SELECT * FROM Table Where DateField = '" & varDate & "'"
    End If

    'And then execute the query / open something based upon it as you require.
    Naturally - it's better to use a form to grab the requested date value - as you can perform better validation and/or offer tools to help enter the date.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    This article is a continuation or rather an extension from Cascading Combos ( and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now