Kamis, 25 September 2014

[MS_AccessPros] Recordset vs RecordsetClone

 

A while ago someone (I don't remember his name and the post number) on this websiteme assisted to put up the below function, it works pretty good and I have been using it. 

In the below procedure, the RecordsetClone property is used, somehow I have not yet had a clear understanding that the differences between the Recordset and the RecordsetClone. I only understand the RecordsetClone is a copy of the recordset. I have also tried, changed the RecordsetClone to Recordset to try to see if it makes any difference. However it seems to be working ok so far and give me no trouble. Can someone point me to a clear understanding how to use the 2 properties?

 

Phucon'Find the record and delete it.Public Function FindFormRecord(SearchForm As Access.Form, SearchField As String, SearchValue As Variant, Optional NoMatchMessage As String = "Record not found") As BooleanOn Error GoTo ErrorHandler'With SearchForm.RecordsetWith SearchForm.RecordsetCloneSelect Case .Fields(SearchField).Type        Case dbText             SearchValue = Chr$(34) & SearchValue & Chr$(34)        Case dbLong             SearchValue = SearchValue    End Select  If Not .EOF Then         .FindFirst "[" & SearchField & "] = " & SearchValue            If Not .NoMatch Then    'if found then delete the record.               If MsgBox("You are deleting this record and all related records. " & vbCrLf & "Proceed to delete?", vbInformation + vbYesNo, "Confirm Delete") = vbYes Then                    .Delete                    TempVars.Add "tvYes", True                End If            Else                TempVars.Add "tvYes", False                MsgBox NoMatchMessage                GoTo ExitDelete            End IfElse    GoTo ExitDeleteEnd IfEnd WithExitDelete:    Exit FunctionErrorHandler:        MsgBox Err.Number & vbCrLf & Err.Description        Resume ExitDeleteEnd Function

__._,_.___

Posted by: saigonf7q5@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar