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
Post a Comment