• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

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?

Thanks
Gar
0
GarDog17
Asked:
GarDog17
1 Solution
 
Leigh PurvisDatabase 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.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now