在Calendar control 11.0代码方面需要帮助(在Access 2003中) [英] Need help with Calendar control 11.0 code (in Access 2003)

查看:74
本文介绍了在Calendar control 11.0代码方面需要帮助(在Access 2003中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要帮助Calendar control 11.0代码(在Access 2003中) 有没有办法创建表单并使用Calendar Control 11.0并对其进行编程,以便在单击日期时运行查询或报告主表上列出的具有该日期的任何东西?
(对于访问2003)

我在一个不同的Visual Basic代码论坛中发布了这个,我给了一个链接转发到这里。任何帮助将不胜感激。

Need help with Calendar control 11.0 code (in Access 2003)Is there a way to create a form and use the Calendar Control 11.0 and program it so when you click on a date it runs a query or report with any thing that is listed on the main table with that date?
 (for access 2003)

I posted this in a diffrent forum for Visual basic code, and i was given a link to repost here. Any help would be appreciated.

推荐答案

您需要拖动Canledar控件和日历控件的属性将返回所选日期。
它非常容易使用。

有关Canledar Control的教程,请参阅以下链接。
http://accessvbadeveloper.wordpress.com/2009/05/21/教程 - 日历控制/

希望在您的教程之后,您可以根据需要在项目中使用日历控制。

代码详情:
选项比较数据库
选项显式

Private Sub cal01_DblClick()
< span class = style3> txtRptDate.SetFocus
txtRptDate.Value = Form at( cal01.Value ," dd-MMM-yyyy")
cal01.Visible = False
End Sub

Private Sub cmdGetReport_Click()
如果是IsDate(txtRptDate.Value)那么
'''''
DoCmd.RunSQL"插入tData(idate,iDetails)值(#" &安培; txtRptDate.Value& "#,'文字输入'& now())"
DoCmd.OpenReport" RptData",acViewPreview ,," idate =#" &安培; txtRptDate.Value& "#"
''''''''''''''''' ''''''
Else
MsgBox"请选择日期"
End If
End Sub

Private Sub cmdShowCalender_Click()
如果cal01.Visible = False则cal01.Visible =真
End Sub

私有子详细信息_ MouseMove(Button As Integer,Shift As Integer,X as Single,Y as Single)
if cal01.Visible = True然后txtRptDate.SetFocus:cal01.Visible = False
End Sub

You need to drag Canledar control and Value Property of calender control will return selected date.
Its really easy to use it.


For the tutorial of Canledar Control refer below link.
http://accessvbadeveloper.wordpress.com/2009/05/21/tutorial-for-calendar-control/

Hope after your tutorial, you will be able to use calender control in your project as you need.

Code Details :

Option Compare Database
Option Explicit

Private Sub cal01_DblClick()
    txtRptDate.SetFocus
    txtRptDate.Value = Format( cal01.Value , "dd-MMM-yyyy")
    cal01.Visible = False
End Sub

Private Sub cmdGetReport_Click()
    If IsDate(txtRptDate.Value) Then
        '''''''''''''''''''''''''''''
        DoCmd.RunSQL "Insert into tData (idate,iDetails) values(#" & txtRptDate.Value & "#,'Text Entered on '& now())"
        DoCmd.OpenReport "RptData", acViewPreview, , "idate=#" & txtRptDate.Value & "#"
        '''''''''''''''''''''''''''''
    Else
        MsgBox "Please select date"
    End If
End Sub

Private Sub cmdShowCalender_Click()
    If cal01.Visible = False Then cal01.Visible = True
End Sub

Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If cal01.Visible = True Then txtRptDate.SetFocus: cal01.Visible = False
End Sub


这篇关于在Calendar control 11.0代码方面需要帮助(在Access 2003中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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