从文本框获取日期到查询并将其用作连接 [英] Get date from textbox into query and use it as join

查看:97
本文介绍了从文本框获取日期到查询并将其用作连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户输入开始日期和结束日期以过滤记录。


在表格中,数据设置如下:

The user is entering a start date and end date to filter records.

In the table, the data is set up like so:

展开 | 选择 | 换行 | 行号

推荐答案

让我们假设用户在名为frmDateRange的表单上输入日期,控件名称为txtStart和txtEnd。此外,由于我不确定日期字段的名称是什么,我将其称为DateField。所以查询的WHERE子句就像这样。
Lets assume that the user is entering the dates on a form named frmDateRange with the control names being txtStart and txtEnd. Also, since I''m not sure what the date field''s name is, I''ll call it DateField. So the WHERE clause of your query would be like this.
展开 | 选择 | Wrap | 行号


mcupito:

他们如何输入信息?

通过表格文本字段?

然后,在VBA中,您可以直接通过引用控件或构建SQL字符串来提取和使用该信息。


也可以你想要一个VBA解决方案或SQL解决方案还是一个混合体?


你现在应该知道,初始信息越好,答案就会越快越好。 (^ _ ^)
mcupito :
How are they entering the information?
Via form text fields?
Then, in VBA, you can pull and use that information either directly by reference to the controls or build the SQL string.

Also do you want a VBA solution or an SQL solution or a hybrid?

You should know by now that the better the initial information the better and faster the answers arrive. (^_^)


Seth,你和我交叉发布。 (^_^)


我尽量避免假设回答问题的阶段。最好从清晰的情况开始,因为它需要更少的帖子才能找到解决方案。
Seth, you and I cross posted. (^_^)

I try to avoid the "assumption" phase of answering questions. Much better to start with a clear picture of the situation as it takes fewer posts to get to the solution.


这篇关于从文本框获取日期到查询并将其用作连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆