I am trying to write a macro that will create a query based on user input. The user needs to input a date at the start of the macro and the macro will then incorporate that date into a SQL query. The problem is I am unsure how to incorporate the date into the SQL SELECT statement. I was thinking of using string concatenation but I am unsure how to do so in the SQL statement.
Sub RevH()
Dim dte As String, clientQry As String, db As Database, clientQry1 As Variant
Set db = CurrentDb
dte = InputBox("What date was the Data Dump run?", "Please Input a date")
clientQry = "SELECT DISTINCT " & _
"FN_DataDump_ALL_11032014.[CLIENT ID], " & _
"FN_DataDump_ALL_11032014.[CLIENT NAME] " & _
"FROM " & _
"FN_DataDump_ALL_11032014 " & _
"WHERE (((FN_DataDump_ALL_11032014.[CLIENT NAME]) Not Like ""*Test*"" ));"
clientQry1 = db.CreateQueryDef("NewIDs", clientQry)
End Sub
dtevariable will replace the 11032014 in the table name. Is there any way to do that?