G
gmazza via AccessMonster.com
Hey there,
I am trying to open a recordset twice for the same table and I am getting
this error.
I named the recordset's different names but still get this error.
This is my code, more or less, just the parts that matter:
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset
intCount = 0
activityCount = 50
Set rs1 = CurrentDb.OpenRecordset("Criteria")
If rs1.RecordCount > 0 Then
rs1.MoveFirst
Do While Not rs1.EOF
For Each fld In rs1.Fields
If fld.Name = "ClinicalTrialId" Then
If fld.Value = 1 Then
Else
Exit For
End If
End If
Set rs = CurrentDb.OpenRecordset("Criteria")
If rs.RecordCount > 0 Then
rs.MoveFirst
Do While Not rs.EOF
For Each fld In rs.Fields
If fld.Name = "CriteriaValue" Then
If IsNull(fld.Value) Then
Exit For
Else
intCount = intCount + 1
With Me.Controls("Label" & intCount)
.Caption = fld.Value
.Visible = True
End With
End If
End If
If fld.Name = "CriteriaText" Then
If IsNull(fld.Value) Then
Exit For
Else
activityCount = activityCount + 1
With Me.Controls("Text" & activityCount)
.Visible = True
End With
End If
End If
Next fld
rs.MoveNext
Loop
End If
Next fld
rs1.MoveNext
Loop
End If
' Clean up objects.
Set fld = Nothing
rs.Close
Set rs = Nothing
Set fld = Nothing
rs1.Close
Set rs1 = Nothing
Any help is appreciated!
I am trying to open a recordset twice for the same table and I am getting
this error.
I named the recordset's different names but still get this error.
This is my code, more or less, just the parts that matter:
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset
intCount = 0
activityCount = 50
Set rs1 = CurrentDb.OpenRecordset("Criteria")
If rs1.RecordCount > 0 Then
rs1.MoveFirst
Do While Not rs1.EOF
For Each fld In rs1.Fields
If fld.Name = "ClinicalTrialId" Then
If fld.Value = 1 Then
Else
Exit For
End If
End If
Set rs = CurrentDb.OpenRecordset("Criteria")
If rs.RecordCount > 0 Then
rs.MoveFirst
Do While Not rs.EOF
For Each fld In rs.Fields
If fld.Name = "CriteriaValue" Then
If IsNull(fld.Value) Then
Exit For
Else
intCount = intCount + 1
With Me.Controls("Label" & intCount)
.Caption = fld.Value
.Visible = True
End With
End If
End If
If fld.Name = "CriteriaText" Then
If IsNull(fld.Value) Then
Exit For
Else
activityCount = activityCount + 1
With Me.Controls("Text" & activityCount)
.Visible = True
End With
End If
End If
Next fld
rs.MoveNext
Loop
End If
Next fld
rs1.MoveNext
Loop
End If
' Clean up objects.
Set fld = Nothing
rs.Close
Set rs = Nothing
Set fld = Nothing
rs1.Close
Set rs1 = Nothing
Any help is appreciated!