Results 1 to 6 of 6
  1. #1
    Accu-Grind is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2015
    Posts
    25

    Run-time Error 3021

    Sub Combo25_AfterUpdate()


    ' Find the record that matches the control.
    Me.RecordsetClone.FindFirst "[ACCT] = " & Me![Combo25]
    Me.Bookmark = Me.RecordsetClone.Bookmark
    End Sub

    This is my code. It was working until I moved on to a different section of my form. Now it gives an error when I run the combo box.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    What line is it throwing an error on? Perhaps there was not a record found. You could add some code to determine if bookmarkable.
    https://www.accessforums.net/forms/f...tml#post225865

    However, I usually use NoMatch with .FindFirst. Either way, you are going to have to assign the recordset to a new Object variable.
    Code:
    dim rs as dao.recordset
    set rs = me.recordsetclone
    'or maybe
    'set rs = Me.RecordsetClone.FindFirst "[ACCT] = " & Me![Combo25]

  3. #3
    Accu-Grind is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2015
    Posts
    25
    Me.Bookmark = Me.RecordsetClone.Bookmark
    This is what it says it doesnt like

    And by moved on I mean I made a subform and was working on that

    There are multiple tables I'm pulling information from to make my form. The main one is just the company name (this has the combo box). The subform is another table that needs to have the data added to it from that form.

    Here, I took out all the info and compressed it. Not sure this will help since there's nothing in it. No one seems to understand what I'm talking about.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Okay, combobox and code are both with the main form.

    The Relationship link between Customer and Customer Section 1 table is wrong. The link should be on the primary key Acct and foreign key Acct, not ID. You are linking the Customer Section 1 subform to the Company Name. Master/Child links should be on Acct fields.

    Should not include Customer Section 1 table in the RecordSource for Customer CAR. Just bind to Customer table. Have a textbox bound to CName field. I would move the UNBOUND search combobox to the form Header area or at least set it apart from the bound textboxes.

    Customer Section 2 does not have foreign key Acct field. There is no way to relate this table with Customer table.

    The code works for me.


    Should give controls, especially those referenced in code, more meaningful names than Combo25.

    Advise not to use spaces in naming convention.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Accu-Grind is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2015
    Posts
    25
    Quote Originally Posted by June7 View Post
    Okay, combobox and code are both with the main form.

    The Relationship link between Customer and Customer Section 1 table is wrong. The link should be on the primary key Acct and foreign key Acct, not ID. You are linking the Customer Section 1 subform to the Company Name. Master/Child links should be on Acct fields.

    Should not include Customer Section 1 table in the RecordSource for Customer CAR. Just bind to Customer table. Have a textbox bound to CName field. I would move the UNBOUND search combobox to the form Header area or at least set it apart from the bound textboxes.

    Customer Section 2 does not have foreign key Acct field. There is no way to relate this table with Customer table.

    The code works for me.


    Should give controls, especially those referenced in code, more meaningful names than Combo25.

    Advise not to use spaces in naming convention.

    I fixed the relationships, but I have no idea what you are talking about when it comes to recordsource. Just so we are clear, I never learned access. I do not have a book that clearly explains this for me and this forum is all I have for knowledge of what to do. Microsoft programs were not in my job description.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    The RecordSource is a property of the form or report and defines the source of data presented on the form or report. This is very basic Access functionality. I suggest you get an introductory book and learn the basics or complete some on-line tutorials. Here is one http://www.rogersaccesslibrary.com/
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error 3021 on a few workstations
    By Turncloud in forum Programming
    Replies: 3
    Last Post: 07-11-2014, 06:54 AM
  2. 3021 Error
    By RonL in forum Programming
    Replies: 6
    Last Post: 05-10-2013, 03:45 PM
  3. Error 3021
    By Marianna_Air in forum Forms
    Replies: 27
    Last Post: 08-20-2012, 01:13 PM
  4. Run Time Error 3021 - Access 2002 SP3
    By alpinegroove in forum Programming
    Replies: 9
    Last Post: 01-24-2012, 04:38 PM
  5. Replies: 8
    Last Post: 05-16-2011, 06:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums