請問諸先進我在執行到save時出現錯誤如下
"在這個範圍中不允許應用程式所要求的操作"
??好像是不能rsProduction.Requery
??是何原因?如何決解決??
vb新手 cmhung
Private Sub Form_Load()
Dim mstring As String
Dim t As Integer
Set conProduction = New ADODB.Connection
Set cmdProduction = New ADODB.Command
Set rsProduction = New ADODB.Recordset
mstring = "Provider=Microsoft.jet.OLEDB.4.0;" & _
"Data Source = e:\cmhung\budgetsys1.mdb;" & _
"Persist Security Info = False"
conProduction.Open mstring
Set cmdProduction.ActiveConnection = conProduction
cmdProduction.CommandText = "select * from tbProduction"
rsProduction.CursorLocation = adUseClient
rsProduction.Open cmdProduction, , adOpenDynamic, adLockPessimistic
For t = 0 To 2
Set Text1(t).DataSource = rsProduction
Text1(t).Locked = True
Next t
Text1(0).DataField = "fldProductionNumber"
Text1(1).DataField = "fldProductionName"
Text1(2).DataField = "fldProductionType"
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
...
..
Case "save"
ssql = "update tbProduction set " _
& "fldProductionName = '" & Text1(1).Text & "'," _
& "fldProductionType = '" & Text1(2).Text & "'" _
& "where fldProductionNumber = '" & Text1(0).Text & "'"
conProduction.Execute ssql
rsProduction.Requery