Error: Object Required

mrsgwen

Registered User.
Local time
Today, 11:18
Joined
Dec 9, 2008
Messages
26
I keep getting the error object required. Can anyone please look at my code and tell my why I'm getting this error?:confused:

Private Sub cmdAddRec_Click()
On Error GoTo Err_cmdAddRec_Click
Dim rstFile As New ADODB.Recordset
Dim fld As ADODB.Field
Dim strField As String

rstFile.Open "dbo_tbl_Files", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If IsNull(Me.FileID.Value) Then
'this is new record
rstFile.AddNew
Else
'to stay on the record that was just inserted for editing
rstFile.Find ("FileID=" + Str$(Me.FileID))
End If
rstFile!FileNo = Me.FileNo
rstFile!FileName = Me.FileName
rstFile!Dept = Me.Dept
rstFile!SectID = Me.SectID
rstFile!DateOpened = Me.DateOpened
rstFile!AttyID = Me.AttyID
rstFile!Description = Me.Description
rstFile!Status = Me.Status

rstFile.Update
'this was a new record so update the form value of FileID for edit
If IsNull(rstFile!FileID.Value) <> True Then
Me.FileNo = rstFile!FileID.Value
End If
rstTrans.Close
Set rstFile = Nothing
AddNewRec
'DoCmd.GoToRecord , , acNewRec
Exit_cmdAddRec_Click:
Exit Sub
Err_cmdAddRec_Click:
MsgBox Err.Description
Resume Exit_cmdAddRec_Click

End Sub
 
What line? Offhand, I don't see this being set or declared anywhere:

rstTrans.Close
 
Is "AddNewRec" a function or sub routine?

Richard
 

Users who are viewing this thread

Back
Top Bottom