Moving to current record after a requery

Fear Naught

Kevin
Local time
Today, 00:16
Joined
Mar 2, 2006
Messages
229
I have a subform where the user enters the number of training days on a quotation. After the record is updated I do a requery on a text boxt on the main form that shows the total number of training days ordered for that particular customer.

The problem is the focus then resorts to somewhere else on the main form but I want it to return to the same record on the subform. I have managed to get it to go to the first record in the subform but obvisouly from users perception that is not god enough.

I have got the following code in the sub form's after update event but nothing seems to work although I do not get any errors.

Code:
Private Sub Form_AfterUpdate()
    If Me.TrgType = 1 Then

        Dim rs As DAO.Recordset
        Dim varBookmark As Variant
        Set rs = Me.RecordsetClone
        rs.FindFirst ("QuoteItemID = " & Me.QuoteItemID)
        varBookmark = rs.Bookmark
        Forms!frmCustomer!txtUnitsOrdered.Requery
        Forms!frmCustomer.Refresh
        Me.Bookmark = varBookmark
        Me.QuotedPrice.SetFocus
        rs.Close
        Set rs = Nothing
        
    End If

Any assistance would be most appreciated :)

And yes Ghudson I have done a search - LOL :p
 
I have also added a breakpoint to enable debugging and when hovering the mouse over 'varBookmark = rs.Bookmark' it shows as 'rs.bookmar = <no current record.>'

I am wondering if there is a syntax error in the line:

Code:
rs.FindFirst ("QuoteItemID = " & Me.QuoteItemID)

Although no errors are showing up

HTH
 

Users who are viewing this thread

Back
Top Bottom