Results 1 to 12 of 12
  1. #1
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199

    Default to new record after combo box select.

    Hello,

    I have a Form with fields to enter what's needed to create a record. On the same Form Page, I have a subform connected to a pass through query from a combobox. The issue is that the first time I select from my combobox, the last record in my database appears in the form fields. How can I fix that so that Access defaults to a new record after I select the choice from my combobox? Thanks,

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    If you want a new record, why are you selecting something from combobox? What is the combobox choice for - to filter main form?
    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.

  3. #3
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    Hi June7, the Combobox is used to filter a query which is being displayed in the Form. It's essentially output from the database which would be important to know for someone entering info into the fields/database.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I don't use dynamic parameterized queries. If that's want you are doing, then code needs to requery the form after selection.
    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
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    June7, why don't you use dynamic parameterized queries?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Too often when I am developing I open query to look at data and parameter input popups are not wanted and annoying.

    I use code to apply filter criteria to forms and reports.
    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.

  7. #7
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    June7, ok I actually meant to say that I was using filter criteria. There are no Dynamic Criteria Pop Ups. I agree, those are super-annoying.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Still not sure what you need to happen.

    Combobox is on main form and it is used to filter main form? Then you want the subform to have focus on its new record row?
    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.

  9. #9
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    June7,

    The Combobox is on a subform. I'm using this to open to a new entry when the form is opened:

    Private Sub Form_Load()DoCmd.GoToRecord , , acNewRec
    End Sub
    and I'm using this on my combobox:

    Private Sub Combo71_AfterUpdate()
    Me.Requery
    End Sub

    Everything works fine except for the first time I use the combo box. In that case, the last record in my database shows up. How can I refresh/show a blank record in all instances after using the combobox.

    Thanks!

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What is the combobox for? Are you saving the selection into subform record? Is this this only data entry? If you want to move to new record (blank) row of the subform then have code in the combobox AfterUpdate event to do that, just as you have in the main form Load event.

    I don't see a need for the Me.Requery.
    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.

  11. #11
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    June7, this is exactly what I need help with. Could you provide the code? (I'm using the combobox to filter a query, which is being displayed as a sub-form)

    Code:
    If you want to move to new record (blank) row of the subform then have code in the combobox AfterUpdate event to do that, just as you have in the main form Load event.

  12. #12
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    June7,

    Someone else told me to try setting DataEntry mode on the form to True and that solved my problem. No need to most the code for me. Thanks as usual though!

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

Similar Threads

  1. Select Default Printer
    By pkstormy in forum Code Repository
    Replies: 4
    Last Post: 03-10-2015, 09:26 AM
  2. Replies: 4
    Last Post: 12-19-2013, 05:35 PM
  3. Replies: 8
    Last Post: 05-25-2013, 05:24 PM
  4. Combo boxes both primary keys to select record
    By Alexandre Cote in forum Forms
    Replies: 3
    Last Post: 08-10-2010, 07:11 AM
  5. Replies: 3
    Last Post: 06-27-2009, 03:53 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