我有一个未绑定的文本框,我想在其中输入数字,然后它将以表格的形式显示。当我这样做时,我也想以另一种形式更改复选框的状态。就像库存。当我将此项目添加到此框中时,我需要更改复选框的值,因为它不再存在于库存中。因此,我拥有的表单是“ Info”,并且复选框名为“ ChkboxAvailableUse”。我的复选框也与套件编号,位置和材料相关。因此,当我在名为“ AssignKit”的未绑定文本框中输入数字时,我希望该数字在“信息”表格和“ InvKitNumber”文本字段中查找相同的工具箱编号,然后将该记录复选框(ChkboxAvailableUse)更改为更改为false。我希望这是有道理的。我有我认为可以在下面工作的代码行。任何帮助都将是极好的。
CurrentDb.Execute " UPDATE Info SET ChkboxAvailableUse = FALSE WHERE InvKitNumber = " & Me.AssignKit & ""
如果只希望该表单取消选中或签入表格以匹配您的表单或子表,则可以使用一个记录集。
Dim myR as Recordset
Dim strSQL as String
'This SELECT string will pull from the assignkit field in the subform
'and will be used find the matching record in the table
strSQL = "SELECT * FROM info WHERE InvKitNumber = '" & Me!subformnamehere.Form.AssignKit & "'"
'This will make your recordeset variable the one record you want to modify
Set myR = db.OpendRecordset(strSQL, dbOpenDynaset)
'Now that the recordset is pointing to that row, you can change the checkbox
'with something like this, and even use an IF statement
myR.Edit
myR![ChkboxAvailable] = True
myR.Update
'Then close the recordeset when done
Set myR = Nothing
希望对您有所帮助,如果您需要我帮助我,请告诉我。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句