问题描述
我尝试使用交叉表查询创建月度趋势图。
我的目标是从名为 StartDate 以过滤器的形式:
12个月由数字1到12表示为列名。
真实问题是将列名称(1到12)转换回月份和年份。
最简单的转换方法是:
•第1列是[Forms]! [过滤]![StartDate]
•第2列是DateAdd(m,1,[Forms]![Filter]![StartDate])
•列3是DateAdd(m,2,[Forms]![Filter]![StartDate])等
•第12列是DateAdd(m,11,[[表格] ]![过滤器]![StartDate])
但是,MS访问将完全拒绝接受上面的列名转换。
有谁知道如何根据文本框值转换列名?我几乎浪费了大部分时间来破解我的头脑而没有即将发生的事情。
我想,将一些变量声明为文本,为其指定文本框值并将其声明为查询列名称可能是前进的方向,但只是在十字路口。 ??
感谢一些方向和帮助。
I have tried to create a monthly trend graph using cross tab query.
My aim is to extract the last 12 months starting from date specified in a text box called StartDate in a form called Filter:
The 12 months are represented by numbers 1 to 12 as column names.
The real problem is converting the column names ( 1 to 12)back to month and year.
The easiest way to convert is:
•Column 1 is [Forms]! [Filter]![StartDate]
•Column 2 is DateAdd("m",1,[Forms]! [Filter]![StartDate] )
•Column 3 is DateAdd("m",2,[Forms]! [Filter]![StartDate] ) etc. to
•Column 12 is DateAdd("m",11,[ [Forms]! [Filter]![StartDate])
However, MS access will totally refuses to accept the above column name conversion.
Does anyone know how to convert the column names based on text box values? I almost wasted most of my time cracking my head and nothing forthcoming.
I guess, declaring some variables as text, assign text box values to it and declare it as query column name could be a way forward but just at the cross roads. ??
Appreciate some direction and assistance.
推荐答案
这篇关于根据文本框值更改查询列名称。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!