|
-
Jul 17th, 2006, 09:24 AM
#1
Thread Starter
New Member
runtime error '-214 7217900(80040e14)
hi
this is the error i get when i run my program
i have put 3 asterisks at the beginning of the line which attempt to open the recordset(cRS.open "Movies,adopenStatic,adlockoptimistic)
pls help
Option Explicit
Dim cRS As ADODB.Recordset
Private Sub Form_Load()
' declare a module-level variable of type Recordset
' This type exists in the external library ADODB
Dim strConn As String
Dim Moviesrset As New ADODB.Recordset
' create an object of type ADODB.Recordset and
' make the variable cRS point to the new object
Set cRS = New ADODB.Recordset
' set the connection string
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\acp\acp\globalDVD.mdb;Persist Security Info=False;Jet OLEDB atabase Password=globalcomm"
' force the recordset object to connect directly to a table of the database
****cRS.Open "Movies", strConn, adOpenDynamic, adLockOptimistic ' update form fields with current record values
UpdateForm cRS
End Sub
Private Sub UpdateForm(pRS As ADODB.Recordset)
txtMovieID = pRS.Fields("MovieID")
txtTitle = pRS.Fields("Title")
txtStudio = pRS.Fields("Studio")
txtDirector = pRS.Fields("Director")
txtRDate = pRS.Fields("RDate")
End Sub
Private Sub ResetForm(pRS As ADODB.Recordset)
txtMovieID = ""
txtTitle = ""
txtStudio = ""
txtDirector = ""
txtRDate = ""
End Sub
Private Sub UpdateRS(pRS As ADODB.Recordset)
pRS.Fields("Title") = txtTitle
pRS.Fields("Studio") = txtStudio
pRS.Fields("Director") = txtDirector
pRS.Fields("RDate") = txtRDate
End Sub
Private Sub cmdDel_Click()
Dim intResult As Integer
If (Not cRS.BOF) And (Not cRS.EOF) Then
intResult = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Deletion Confirmation")
If intResult = vbYes Then
cRS.Delete
cmdFirst_Click
End If
End If
End Sub
Private Sub cmdExit_Click()
cRS.Close
Set cRS = Nothing
Unload Me
End
End Sub
Private Sub cmdFirst_Click()
cRS.MoveFirst
UpdateForm cRS
End Sub
Private Sub cmdLast_Click()
cRS.MoveLast
UpdateForm cRS
End Sub
Private Sub cmdNew_Click()
If Not cRS.EOF Then
cRS.AddNew
ResetForm cRS
txtTitle.SetFocus
End If
End Sub
Private Sub cmdNext_Click()
If Not cRS.EOF Then
cRS.MoveNext
If cRS.EOF Then
cRS.MoveFirst
End If
UpdateForm cRS
End If
End Sub
Private Sub cmdPrev_Click()
If Not cRS.BOF Then
cRS.MovePrevious
If cRS.BOF Then
cRS.MoveLast
End If
UpdateForm cRS
End If
End Sub
Private Sub cmdSave_Click()
If (Not cRS.BOF) And (Not cRS.EOF) Then
UpdateRS cRS
cRS.Update
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|