Inserting a record, error message appears.

D

David Mc

Hi

I have tried to insert a record into a database, i run a
update command on a text box (this triggers the insert
record section, and all i get in the error

unrecognised database format 'E:\Results.mdb'.

Why is this occuring. i am using access 2002.

The code is below for the update.

Thanks in advance.

David

Sub AddNewResitLetterDetails(Student_ID, Course_Title,
Element_Description, Date_Taken)

Dim dbsITExaminations As Database
Dim rstResit As Recordset
Dim strStudentID As String
Dim strCourse As String
Dim strElement As String
Dim dtExamDate As Date


Set dbsITExaminations = OpenDatabase("E:\Development
Database.mdb")
Set rstResit = dbsITExaminations.OpenRecordset
("Resits", dbOpenDynaset)

strStudentID = Student_ID
strCourse = Course_Title
strElement = Element_Description
dtExamDate = Date_Taken

' Call the function that adds the record.
AddName rstResit, strStudentID, strCourse, strElement,
dtExamDate

rstResit.Close

End Sub

Function AddName(rstResitTemp As Recordset, strStudentID
As String, strCourse As String, strElement As String,
dtExamDate As Date)

' Adds a new record to a Recordset using the data
passed
' by the calling procedure. The new record is then made
' the current record.
With rstResitTemp
.AddNew
!StudentID = strStudentID
!Course = strCourse
!Element = strElement
!ExamDate = dtExamDate
.Update
End With

End Function
 

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