sql - String concatenation in Access VBA -


i trying write macro create query based on user input. user needs input date @ start of macro , macro incorporate date sql query. problem unsure how incorporate date sql select statement. thinking of using string concatenation unsure how in sql statement.

sub revh() dim dte string, clientqry string, db database, clientqry1 variant   set db = currentdb   dte = inputbox("what date data dump run?", "please input 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  ""*test*"" ));"  clientqry1 = db.createquerydef("newids", clientqry) end sub 

it easier if use table alias:

dte = inputbox("what date data dump run?", "please input date (mmddyyyy)")   clientqry = "select distinct t.[client id], t.[client name] " & _             "from fn_datadump_all_" & dte & " t " & _              " (((t.[client name]) not  ""*test*"" ));" 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -