刚刚学数据库编程,楼上的大哥不好意思啊 我可能没说明白,把代码全贴出来帮我看看 Private Sub Command1_Click() Dim i As Integer Dim j As Integer Dim N As Integer rs.Open "Select * From3 cws", conn, 3, 3 N = rs("cws") If Trim(Text1.Text) = "" Then '如果无输入 MsgBox "请输入数量!", vbOKOnly + vbCritical, "错误" End If If Val(Text1.Text) > 208 Then MsgBox "对不起,本系统暂时最多只支持100个,请重新输入!", vbOKOnly + vbCritical, "错误" Text1.Text = "" End If If Val(Text1.Text) = 0 Then MsgBox "数量必须大于0!", vbOKOnly + vbCritical, "错误" Text1.Text = "" End If If Val(Text1.Text) > 0 And Val(Text1.Text) <= 208 Then '设置数量 For i = 0 To N - 1 form1.Command1(i).Visible = True Next i For j = N To 99 form1.Command1(j).Visible = False Next j Data1.Recordset.Edit Unload Me End If End Sub 这个代码需要如何修改? 在线等…………
N=rs("cws")
我可能没说明白,把代码全贴出来帮我看看
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim N As Integer
rs.Open "Select * From3 cws", conn, 3, 3
N = rs("cws")
If Trim(Text1.Text) = "" Then '如果无输入
MsgBox "请输入数量!", vbOKOnly + vbCritical, "错误"
End If
If Val(Text1.Text) > 208 Then
MsgBox "对不起,本系统暂时最多只支持100个,请重新输入!", vbOKOnly + vbCritical, "错误"
Text1.Text = ""
End If
If Val(Text1.Text) = 0 Then
MsgBox "数量必须大于0!", vbOKOnly + vbCritical, "错误"
Text1.Text = ""
End If
If Val(Text1.Text) > 0 And Val(Text1.Text) <= 208 Then '设置数量
For i = 0 To N - 1
form1.Command1(i).Visible = True
Next i
For j = N To 99
form1.Command1(j).Visible = False
Next j
Data1.Recordset.Edit
Unload Me
End If
End Sub
这个代码需要如何修改?
在线等…………
就用N = Data1.Recordset!cws就可以赋值了
不过,还是谢谢楼上那位兄弟啊。