ForcedToUseIt
Registered User.
- Local time
- Today, 03:35
- Joined
- Jul 25, 2004
- Messages
- 34
Hi I have a .mdb FE running on a SQL server BE. When I run the following code I get the 3021 error: No current record in the line:
rst.FindFirst ("DrawNo = '" & DrawNo & "'")
Does anyone have advice for me. Do I have to convert the code to ADO to be able to do this or is there some workaround for this. BTW the recordset is usually empty so the error is not so surprizing but that is the way that I want it to be because im trying to fill the empty recordset as you can see.
Any help would be much appreceated.
rst.FindFirst ("DrawNo = '" & DrawNo & "'")
Does anyone have advice for me. Do I have to convert the code to ADO to be able to do this or is there some workaround for this. BTW the recordset is usually empty so the error is not so surprizing but that is the way that I want it to be because im trying to fill the empty recordset as you can see.
Code:
Private Sub butStoreDrawings_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim TransNo As Long
Dim DrawNo As String
Dim continue As Boolean
Dim currPos As String
If IsNull(Me.combTransmittal.Value) Then
continue = False
MsgBox ("Please select transmittal ")
Else
continue = True
TransNo = Me.combTransmittal.Value
End If
If continue Then
Set dbs = CurrentDb()
strSQL = "SELECT * FROM tblTransDrawingList WHERE TransNo = " & TransNo
Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
Me.Painting = False
currPos = Me.Bookmark
Me.Recordset.MoveFirst
While Not (Me.Recordset.EOF)
If Me.Transm.Value Then
DrawNo = Me.DrawNo
rst.FindFirst ("DrawNo = '" & DrawNo & "'")
If rst.NoMatch Then
rst.AddNew
rst.Fields("TransNo") = TransNo
rst.Fields("DrawNo") = DrawNo
rst.Fields("DrawName") = Left(Me.DrawName, 148)
rst.Fields("Rev") = Me.Rev
rst.Fields("RevDate") = Me.Revisions_Date
rst.Update
Else
rst.Edit
rst.Fields("DrawName") = Left(Me.DrawName, 148)
rst.Fields("Rev") = Me.Rev
rst.Fields("RevDate") = Me.Revisions_Date
rst.Update
End If
End If
Me.Recordset.MoveNext
Wend
Me.Bookmark = currPos
Me.Painting = True
End If
End Sub
Any help would be much appreceated.