设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

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

[模块/函数] 关于update时间后 不会自动更新

[复制链接]

点击这里给我发消息

1#
发表于 2017-3-9 15:56:06 | 显示全部楼层
1. access 没有 short 数据类型,要使用long
2. 你的 ID是文字 ,要定义为String, 不能定义为long ,且 条件前后要加单引号

修改后的正确代码为:


Private Sub ID_AfterUpdate()
    '每次产品更改的初始价格和折扣
    If Not IsNull(Me![ID]) Then
        Me![列出价格] = GetListPrice(Me![ID])
       Me![标准成本] = GetStandardCost(Me![ID])
   
        
        
    '空产品订单表示用户要删除项目
    Else
        eh.TryToRunCommand acCmdDeleteRecord
    End If
End Sub

Function GetStandardCost(lID As String) As Currency
    GetStandardCost = DLookup("[标准成本]", "imp", "[ID]='" & lID & "'")
End Function


Function GetListPrice(lID As String) As Currency
    GetListPrice = DLookup("[列出价格]", "imp", "[ID]='" & lID & "'")
End Function
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-17 03:47 , Processed in 0.102554 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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