Re: ADP bound form - force record save, recordsetclone not populating after requery
- From: "RoyVidar" <roy_vidarNOSPAM@xxxxxxxx>
- Date: Sat, 26 Nov 2005 11:51:34 GMT
Br@dley wrote in message <t_Nhf.3918$ea6.975@xxxxxxxxxxxxxxxxxxxxxxxxxx> :
Lyle Fairfield wrote:I don't have any problem with: With Me.RecordsetClone .Find "Amount > 1000" MsgBox .Collect(0) End With
Perhaps, you should post your updated code?
I thought I did?
Function RefreshForm(myForm As Form, myField As String)
' sample call : RefreshForm Me, "EmployeeID"
On Error GoTo RefreshForm_err
Dim rs As ADODB.Recordset
Dim myValue As Long
Dim myUniqueTable As String
myValue = myForm.Controls(myField).Value
myUniqueTable = myForm.UniqueTable
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdSaveRecord
Set rs = New ADODB.Recordset
With rs
.ActiveConnection = CurrentProject.Connection
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.Source = myForm.RecordSource
.Open
End With
rs.Find myField & " = " & myValue
If rs.EOF Then rs.MoveFirst
Set myForm.Recordset = rs
Set rs = Nothing
myForm.UniqueTable = myUniqueTable
RefreshForm_exit:
Set rs = Nothing
Exit Function
RefreshForm_err:
MsgBox "Could not move to record." & vbCrLf & Err.Description, vbCritical + vbOKOnly, "Error in RefreshForm()"
Resume RefreshForm_exit
End Function
The code on the form that does the search is (I didn't write it...). It works before the above code is run.
Private Sub reposition(ByVal findcode As Long)
Dim CRITERIA As String Dim MYRS As ADODB.Recordset
If IsNull(findcode) Then MsgBox "YOU HAVE NOT MADE A SELECTION" Exit Sub End If
'Error occurs on this line. "AciveX component can't create object" Set MYRS = Me.RecordsetClone
CRITERIA = "[Personnel_No]=" & findcode MYRS.Find CRITERIA If MYRS.EOF Then MsgBox "COULD NOT FIND THE EMPLOYEE: " & findcode Else Me.Bookmark = MYRS.Bookmark End If Set MYRS = Nothing
End Sub
There are a lot of things I do not understand with this, so I hope you'll excuse me if some of this is only a shot in the dark
1 - I seem to recall some anomalities whith recordsetclone on ADO form recordsets in the 2000 version - could you try just using the ..clone method of the form recordset in stead, and see if that changes anything?
Set MYRS = Me.Recordset.Clone
in stead of
Set MYRS = Me.RecordsetClone
2 - I also recall having some challenges with getting form recordets updateable in 2000 version, but don't recall whether that was only when working with mdb's or also when testing ADP's (separate connection, MSDataShape provider ...)
-- Roy-Vidar
.
- Follow-Ups:
- References:
- ADP bound form - force record save, recordsetclone not populating after requery
- From: Br@dley
- Re: ADP bound form - force record save, recordsetclone not populating after requery
- From: Lyle Fairfield
- Re: ADP bound form - force record save, recordsetclone not populating after requery
- From: Br@dley
- Re: ADP bound form - force record save, recordsetclone not populating after requery
- From: Lyle Fairfield
- Re: ADP bound form - force record save, recordsetclone not populating after requery
- From: Br@dley
- Re: ADP bound form - force record save, recordsetclone not populating after requery
- From: Br@dley
- Re: ADP bound form - force record save, recordsetclone not populating after requery
- From: Lyle Fairfield
- Re: ADP bound form - force record save, recordsetclone not populating after requery
- From: Br@dley
- ADP bound form - force record save, recordsetclone not populating after requery
- Prev by Date: Re: Kill all text files except those starting with ~$
- Next by Date: Re: Kill all text files except those starting with ~$
- Previous by thread: Re: ADP bound form - force record save, recordsetclone not populating after requery
- Next by thread: Re: ADP bound form - force record save, recordsetclone not populating after requery
- Index(es):
Relevant Pages
|