设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2036|回复: 4
打印 上一主题 下一主题

我下面的語句不知怎麽不管用呀???

[复制链接]
跳转到指定楼层
1#
发表于 2002-10-22 16:40:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
這個語句我是想,當我輸入一個日期時,讓它與LD_COLOUR_HISTROY表中的EVENT(事件)的APPROVED的日期相比較。
Private Sub txti_Change()
strSQL = "select * from [LD_COLOUR_HISTORY] where ([hld]='" & HLD_no.Value & "') and ([colour]='" & Colour.Value & "') and ([event]='approved')"and (colour='" & Colour.Value & "')"
rst.Open strSQL, CurrentProject.Connection, adOpenStatic, adLockReadOnly
Dim txti As Date, dt1 As Date
If rst("event") = "approved" Then dt1 = rst("date")
If (txti - dt1) > 0 Then
MsgBox "沒有超期,在客戶規定的期限內將樣品交出了!" & "txti-dt1"
ElseIf (txti - dt1) = 0 Then
MsgBox "剛好,在客戶規定的期限內將樣品交出了!" & "txti-dt1"
Else
MsgBox "超期警告!!!" & "txti-dt1"
End If
End Sub




分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2002-10-22 18:00:00 | 只看该作者
strSQL = "select * from [LD_COLOUR_HISTORY] where ([hld]='" & HLD_no.Value & "') and ([colour]='" & Colour.Value & "') and ([event]='azS
3#
发表于 2002-10-25 18:28:00 | 只看该作者
这很明显是语句错了,多了个"在([event]='approved')"后面的"是多余的
4#
发表于 2002-11-19 19:09:00 | 只看该作者
shweiw 说的对
5#
 楼主| 发表于 2002-11-19 21:43:00 | 只看该作者

谢谢我已经解决了

语句如下:
Dim strsql As String
Dim j As Integer
Dim rst As New ADODB.Recordset
strsql = "select top 1 edate from ld_colour_history where (hld='" & HLD.Value & "') and (colour='" & Colour & "') and (event ='" & approved & "') order by edate desc"
rst.Open strsql, CurrentProject.Connection, adOpenStatic
rst.MoveLast

j = DateDiff("d", Text11.Value, rst("edate"))
If j > 0 Then
MsgBox "请注意,这个已经超期了'" & j & "'天"
ElseIf j < 0 Then
MsgBox "在客户规定的期限内完成,并少用了'" & j & "'天"
Else
MsgBox "与客户所需的日期相同"
End If
End Sub
[em26]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-6-16 05:06 , Processed in 0.088164 second(s), 28 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表