你的法典看着ok。 文本Box的特性是以形式设计的方式确定的,只能以形式设计方式永久改变。 你做了一些精细的编码,以设计方式打开表格,改变财产,然后节省形式......或人工操作。 你们总是能够使用你的法典来控制这些财产。
Option Compare Database
Option Explicit
Private Sub cmdGo_Click()
Dim sCode As String
sCode = "xx"
set default values for tonnes enabled and locked properties
txtTonnes.Enabled = False
txtTonnes.Locked = True
If sCode = "xx" Then
enable tonnes field
txtTonnes.Enabled = True
txtTonnes.Locked = False
End If
MsgBox txtTonnes.Name & " Enabled status is " & txtTonnes.Enabled
MsgBox txtTonnes.Name & " Locked status is " & txtTonnes.Locked
End Sub
Private Sub Form_Load()
MsgBox txtTonnes.Name & " Enabled status is " & txtTonnes.Enabled
MsgBox txtTonnes.Name & " Locked status is " & txtTonnes.Locked
End Sub