recordcount gives back -1...

G

Guest

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
 
D

Douglas J. Steele

rst.Open "SELECT * FROM " & tbll.Name & " WHERE CODRATER=" &
Forms(ff.Name).Controls("CERCA").Value, CurrentProject.Connection,
adOpenDynamic, adLockOptmistic
rst.MoveLast
rst.MoveFirst
If rst.RecordCount > 0 Then
 
G

Guest

I have already done this..and it doesn't work!!
That's really strange. Isn't it?

Thanks anyway
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top