查询日期范围< =第2部分 [英] Query date range <= Part 2

查看:72
本文介绍了查询日期范围< =第2部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在重新发布这个帖子,因为它已经变得非常混乱,我有办法解决这个问题所以这是一个与初始线程略有不同的问题。


这里是最初的花纹

http://bytes.com/topic/access/answer...ery-date-range


只是为了澄清一下我正在努力实现....


我有一张带有日历预订记录的表格,这些记录已从outlook导入,因此开始日期和结束日期采用以下格式:dd:mm: yyyy hh:nn:ss这就是我认为是问题的根源


我有一个表单,旨在以星期一 - 星期日的格式显示表格中的日历预订所以用户选择一个日期,并在表格上显示整周,例如,如果用户选择9/9/09,表格将显示从7/9/09 - 13/9/09类似于Outlook的工作方式s


我遇到问题的查询旨在获取该表单上的开始和结束日期范围,并在我所拥有的日期范围内返回表格中的所有日历预订现在让我的工作如何我想要它

展开 | 选择 | Wrap | 行号

解决方案

语法更改应该做的伎俩:

展开 | 选择 | Wrap | Line数字


亲爱的菲尔,


最终我设法查看了你的代码,说实话,我它有点失去了它应该做什么。
  • 确定周界限的部分代码有些不确定。当输入日期是星期日时,预计将在下周提供。这是它应该做的吗?
  • 您的查询应该只返回startdate和endate都在给定周内的记录。这是它应该做的吗?
  • 改变控件外观的代码部分是一个完全神秘的东西。根据我的理解,它改变了控件的外观,这些控件的名称是从起始日期开始的工作日签名,以及在startdate和enddate的时间部分之间的小时。再说一遍,它应该做什么?


问候,

Fish。


嗨大家好


感谢您回复我


对不起造成的任何混淆


OK让我再试一次


我已经重新创建了在我的表单中的outlook日历的外观我想表示该表单上的预订就像outlook预订一样。我使用未绑定的文本框来表示日历列中的时间段,我将这些的颜色更改为代表日历预订


这些展望预订已经从outlook导入我的访问表。


幽默我一秒钟并开启展望日历并选择左侧小日历控件上的3/9/09 .. outlook在每天的列中右侧显示日期31/8/09至06/9/09(mon-sun)本周


这正是我的表单工作方式


所有我需要做的就是写一个第一个日期为31的查询/ 8/09(星期一)和最后一个日期06/9/09(星期日)并搜索该日期范围内的预订,即显示的一周的开始和结束日期


这些日期已经从用户选择中得出n在左侧的小日历控件上,即03/9/09代码然后计算出星期一(2009年8月31日)和星期日(06/09/09)的日期,并将这些日期写入字段中的表单[txtmon]和[txtsun]


下面的查询在单独运行时有效

展开 | 选择 | Wrap | 行号

Hi

I am re-posting this thread because it has become very confusing and I have got some way to solving the problem so it is a slightly different question from the initial thread.

here is the original tread

http://bytes.com/topic/access/answer...ery-date-range

Just to clarify what I am trying to achieve....

I have a table with calendar booking records which has been imported from outlook so the start date and end date are in this format dd:mm:yyyy hh:nn:ss this is what I believe is the root of the problem

I have a form that is designed to display the calendar bookings from the table in a monday - sunday format so a user selects a date and on the form the full week is displayed so for example if the user selects 9/9/09 the form will display from the 7/9/09 - 13/9/09 similar to how outlook works

The query that I was having problems with is designed to pick up the start and end date range on that form and return all the calendar bookings from the table within the date range I have now got this to work how I want it to

Expand|Select|Wrap|Line Numbers

解决方案

A Syntax change should do the trick:

Expand|Select|Wrap|Line Numbers


Dear Phil,

Eventually I''ve managed to look through your code and, to tell the truth, I''m somewhat lost as for what it is supposed to do.
  • Part of the code determining week bounds is somewhat uncertain. When entered date is Sunday it is expected to give the next week. Is it what it is supposed to do?
  • You query is expected to return only those records which both startdate and endate are within a given week. Is it what it is supposed to do?
  • The section of code which changes controls appearance is a total mystery. From what I''ve understood it change appearance of controls which have in their names signature of weekday taken from startdate and hours between time portions of startdate and enddate. Again, is it what it is supposed to do?

Regards,
Fish.


Hi Guys

Thanks for getting back to me

Sorry for any confusion caused

OK let me try again

I have "re-created" the look of an outlook calendar in my form I want to represent the bookings on that form just like an outlook calendar booking.I have used unbound text boxes to represent the time slots in the columns of the calendar and I change the colour of these to represent a calendar booking

These outlook bookings have been imported from outlook into my access table.

humour me for a second and open an outlook calendar and select the 3/9/09 on the small calendar control on the left.. outlook diplays the dates 31/8/09 to the 06/9/09 (mon-sun) on the right hand side in columns representing each day of the week

This is exactly how my form works

all i need to do is write a query that takes the first date the 31/8/09 (Mon) and the last date 06/9/09 (sun) and search for bookings within that date range i.e the start and end date of the week that is displayed

these dates have been worked out from the users selection on the small calendar control on the left hand side ie the 03/9/09 the code then works out the date for monday (31/08/09) and the sunday (06/09/09) and written these dates to the form in the fields [txtmon] and [txtsun]

the query below works when run by itself

Expand|Select|Wrap|Line Numbers


这篇关于查询日期范围< =第2部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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