excel - Write an SQL query selecting data from filtered Date columns -


i trying query crosstab table/recordset in access (tried ado on excel sheet), columns having dates in them e.g.

columns appearing dates

if want pull limited data having columns year 2014, how write such query? please note, these columns may vary.

something this, there may simpler method though

sub akward_query()  dim strsql string dim strsql2 string dim rst adodb.recordset dim fld adodb.field dim intyear integer  intyear = 2014  strsql = "select top 1 * tbl_test"  set rst = new adodb.recordset  rst.open strsql, currentproject.connection, 1  strsql2 = "select "  each fld in rst.fields      if instr(1, fld.name, "week ending") > 0 , instr(1, fld.name, intyear)>0          strsql2 = strsql2 & "[" & fld.name & "],"      end if  next fld  if right(strsql2, 1) = "," strsql2 = left(strsql2, len(strsql2) - 1)  strsql2 = strsql2 & " tbl_test"  end sub 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -