Create a SQL Passthrough prompt

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?

Who is Participating?
Leigh PurvisConnect With a Mentor Database DeveloperCommented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.