Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Cedar Falls, Iowa, USA
    Posts
    268
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update or Cancel Update w/o AddNew or Edit (a2000)

    When I select a record in the cboFind. Then immediately select another one record. Running the code below I get a "Update or cancel update without AddNew or Edit" error. What am I doing wrong?

    Private Sub cboFindConsumer_AfterUpdate()
    ' Comments :
    ' Parameters: -
    ' Modified :
    '
    ' --------------------------------------------------
    ' Find the record that matches the control.
    'TVCodeTools ErrorEnablerStart
    On Error GoTo PROC_ERR
    'TVCodeTools ErrorEnablerEnd

    Dim objRs As Object

    Set objRs = Me.Recordset.Clone
    objRs.FindFirst "[lngConsumerID] = " & Str(Me![cboFindConsumer])
    Me.Bookmark = objRs.Bookmark

    'TVCodeTools ErrorHandlerStart
    PROC_EXIT:
    Exit Sub

    PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT
    'TVCodeTools ErrorHandlerEnd

    End Sub

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Update or Cancel Update w/o AddNew or Edit (a2000)

    From what I can see from previous posts you should replace
    Dim objRs As Object

    Set objRs = Me.Recordset.Clone
    objRs.FindFirst "[lngConsumerID] = " & Str(Me![cboFindConsumer])
    Me.Bookmark = objRs.Bookmark

    with:

    Me.Recordset.Clone.FindFirst "[lngConsumerID] = " & Str(Me![cboFindConsumer])
    Me.Bookmark = Me.RecordsetClone.Bookmark

    Check <post#=406708>post 406708</post#>

  3. #3
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Cedar Falls, Iowa, USA
    Posts
    268
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update or Cancel Update w/o AddNew or Edit (a2000)

    I tried that out but now selecting a record in the cboBox doesn't sync the form to the cboBox. What am I missing here?

    E

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Update or Cancel Update w/o AddNew or Edit (a2000)

    Pat,

    You have a typo in that first line:

    Me.Recordset<font color=red>.</font color=red>Clone.FindFirst "[lngConsumerID] = " & Str(Me![cboFindConsumer])

    should be

    Me.RecordsetClone.FindFirst "[lngConsumerID] = " & Str(Me![cboFindConsumer])

    Otherwise, you aren't using the same clone to set the bookmark.
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Cedar Falls, Iowa, USA
    Posts
    268
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update or Cancel Update w/o AddNew or Edit (a2000)

    That did it.

    E

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Update or Cancel Update w/o AddNew or Edit (a2000)

    Close but not close enough <img src=/S/frown.gif border=0 alt=frown width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •