R
rocco
Hello,
I have code (posted below) which needs to evaluate the numbers of records
entered for each rater of a questionnaire. I can have a maximum of 50 raters.
each rater has a code going from 1 to 50.
But when I evaluate the recordcount property in the code below i always get
a -1 and the code that should be run is skipped...
Here is the code:
Public Sub Salva(tbll As TableDef, ff As Form)
Dim i As Integer
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
If GeneralCheck(ff) = True Then
If finderlet = True Then
MsgBox tbll.Name
MsgBox tbll.RecordCount
rst.Open "SELECT * FROM " & tbll.Name & " WHERE CODRATER=" &
Forms(ff.Name).Controls("CERCA").Value, CurrentProject.Connection,
adOpenDynamic, adLockOptmistic
If rst.RecordCount > 0 Then
For i = 0 To rst.Fields.Count - 2
rst.Fields(i).Value =
IIf(IsNull(Forms(ff.Name).Section(acDetail).Controls(rst.Fields(i).Name).Value), Null, Forms(ff.Name).Section(acDetail).Controls(rst.Fields(i).Name).Value)
Next i
rst.Update
End If
MsgBox "Dati aggiornati!", vbInformation, "Registrazione effettuata"
(follow other code...)
Any hint?
Thanks,
Rocco
I have code (posted below) which needs to evaluate the numbers of records
entered for each rater of a questionnaire. I can have a maximum of 50 raters.
each rater has a code going from 1 to 50.
But when I evaluate the recordcount property in the code below i always get
a -1 and the code that should be run is skipped...
Here is the code:
Public Sub Salva(tbll As TableDef, ff As Form)
Dim i As Integer
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
If GeneralCheck(ff) = True Then
If finderlet = True Then
MsgBox tbll.Name
MsgBox tbll.RecordCount
rst.Open "SELECT * FROM " & tbll.Name & " WHERE CODRATER=" &
Forms(ff.Name).Controls("CERCA").Value, CurrentProject.Connection,
adOpenDynamic, adLockOptmistic
If rst.RecordCount > 0 Then
For i = 0 To rst.Fields.Count - 2
rst.Fields(i).Value =
IIf(IsNull(Forms(ff.Name).Section(acDetail).Controls(rst.Fields(i).Name).Value), Null, Forms(ff.Name).Section(acDetail).Controls(rst.Fields(i).Name).Value)
Next i
rst.Update
End If
MsgBox "Dati aggiornati!", vbInformation, "Registrazione effettuata"
(follow other code...)
Any hint?
Thanks,
Rocco