我有一个是/否勾选框[WireBound]一旦点击 允许[WirePrice]框计算并显示: [NumberOfBox](其中用户输入数字为123格式的数字) 乘以(ExtraPricePerUnit),它是另一种形式,tbl或查询 如果WireBound = True则Val(WirePrice)= Val(NumberOfWireBound)*表格![frmExtras]!Val(ExtraPricePerUnit) End Sub 现在它dosnt显示框中的任何内容[WirePrice] 我应该在[WirePrice]中放置代码并编码[WireBound]类似 如果为True,则转到[WirePrice]或plac这一切都在一个模块中,因为我有8个以上的chek盒子可供使用.. 一如既往地感谢预期 Sal 解决方案 我不确定在没有重新创建项目的情况下会出现什么问题。但是我的建议是验证你从那些字段中获得了什么来改变或点击然后你可以发现罪魁祸首并解决问题。 展开 | 选择 | 换行 | 行号 一个朋友建议这是我对这个问题的回答: Private Sub RingBinder_Click() Dim unitPrice As Double Dim db作为数据库 Dim rs作为记录集 Dim sql As String 如果是Me.RingBinder。值= True然后 设置db = CurrentDb sql ="选择Ex来自tblExtras的traPricePerUnit,其中ExtrasDescription =""Ring Binders"" 设置rs = db.OpenRecordset(sql) unitPrice = rs.Fields(0) .Value Me!RingBinder = Me!NumberOfRingBindersBound.Value * unitPrice Else Me!RingBinder = 0 结束如果 结束子 似乎工作正常(此刻)他说它的动态??? / blockquote> 逻辑看起来很好 Hi Guys.. still trying to do this on my own but need help with below code.. im slowly getting there and loving it(so wish I had discovered this stuff years ago, im actually enjoying my self while at work... :-) )im not sure if ive got it queit right.. Basics:I have a yes/no tick box [WireBound] once clickedallows [WirePrice] box to calculate and to show: [NumberOfBox] ( which user types in Number in "123" format)times by (ExtraPricePerUnit) which is in another form, tbl or queryPrivate Sub WireBound_Click() If WireBound = True Then Val(WirePrice) = Val(NumberOfWireBound) * Forms![frmExtras]!Val(ExtraPricePerUnit) End Subnow it dosnt show anything in the box [WirePrice]Should i place code in [WirePrice] and code [WireBound] something likeIf True then goto [WirePrice] or place it all in a modual as I have 8 more chek boxes for this to work with..As Always thanks in anticipationSal 解决方案 I am not sure what is the problem without recreating your project. But my suggestions is verify what you get from those fields onChange or onClick then you can spot the culprit and work on a solution. Expand|Select|Wrap|Line NumbersA freind suggested this as my answer to the problem:Private Sub RingBinder_Click()Dim unitPrice As DoubleDim db As DatabaseDim rs As RecordsetDim sql As StringIf Me.RingBinder.Value = True Then Set db = CurrentDb sql = "Select ExtraPricePerUnit from tblExtras where ExtrasDescription = ""Ring Binders""" Set rs = db.OpenRecordset(sql) unitPrice = rs.Fields(0).Value Me!RingBinder = Me!NumberOfRingBindersBound.Value * unitPriceElse Me!RingBinder = 0End IfEnd SubIt appears to work fine (at moment) he says its Dynamic ???The logic looks good 这篇关于如果WireBound = True那么Val(WirePrice)= ??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-22 16:39