Results 1 to 2 of 2
  1. #1
    Gabbelgak is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    1

    Navigating a form with a listbox that has default values on new records

    I have a form with a listbox in it that populates based off a query that I then use to select the record I want my user to edit.


    The controlled boxes that are populated by the listbox I have filled with a value based off the last entered record.

    So I have Date for example, when the user adds a record if they had December 31, 2015 selected in the date box it will go to a new record and have the box be automatically filled with the same date on a new record.

    This speeds up data entry substantially for us but has introduced a problem, if the user creates a record then navigates to a record in the listbox it creates a "blank record" with just what I have setup for default values.

    If I turn on the fields are required in the table then it doesn't play nice with listbox navigation and locks it up.
    I've tried using nested IF statements before the search for records macro to set the value of my boxes to blank if they were not null and the other boxes were null but that again is locking the listbox.

    My solution thus far has to just been create a delete query based off missing data but I would rather find a way to not create the blanks to begin with.

  2. #2
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I don't get it. How can a user create a new record if they're choosing something from a listbox that represents records you want them to edit? If that is the case, the record exists, so what is causing the creation of a new record? The edited record not being saved? The form being put into Data Entry mode once the listbox item has been selected?

    Without more info, not really possible to know the cause. I for one don't follow posts very well if a mixed bag of terms is used, and that's the case here (sorry).
    I mean, you want to "edit", but then you say 'when a user adds a record'
    and you have "controlled boxes". What are those?
    you filled the listboxes with a value based off the last entered record?? I thought the listbox was populated with a query.
    You have a "Date", meaning you named a field or control date ? (bad form if you did).
    "If I turn on the fields are required in the table ..." you mean enable form controls?
    "My solution thus far has to just been create a delete query based off missing data" I don't get how you can delete a record that has required fields if they weren't filled in. The record is incomplete and doesn't exist yet. You can cancel the record, but again, I don't see how you can have this condition and still have a record to delete.

    If you're really using macros, then I don't have much other advice to help you. If it's vba code, then put break points on as many events as you can and interact with the form and step through as many of them as you can. If nothing obvious jumps out then I don't know what else to suggest other than compacting and zipping your db and posting it here for examination. First, I'd look for a reason why the activity of a record being edited seems to morph into creating a new one.
    Last edited by Micron; 01-05-2017 at 11:32 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Set default value for listbox for form load
    By Delta729 in forum Access
    Replies: 2
    Last Post: 01-11-2015, 12:39 AM
  2. Replies: 4
    Last Post: 04-01-2014, 02:40 PM
  3. Navigating Records on unbound form with VBA
    By redbull in forum Access
    Replies: 21
    Last Post: 07-03-2013, 10:26 AM
  4. Replies: 4
    Last Post: 03-15-2012, 03:26 AM
  5. Multiple default values in listbox
    By rickscr in forum Forms
    Replies: 3
    Last Post: 04-07-2011, 09:49 AM

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