Results 1 to 2 of 2
  1. #1
    xwnoob is offline Advanced Beginner
    Windows Vista Access 2000
    Join Date
    Nov 2011

    how to prompt user if he already has a record with the same selection in listbox?

    I would like to prompt the user whenever he adds a new record in my form.

    This form has a listbox which users must make a selection.It also has other fields that the user must enter. However, i would like to implement a prompt in the form whereby in the next Add record if the user makes the same selection in the listbox again, he will get a msgbox.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    Better would be not to allow the selection to begin with. Can use code to modify the combobox RowSource on-the-fly.

    Either way, VBA code is required. Might as well do what is friendlier to the user. Use the Form Current event to requery the combobox. When move to next record, the event will trigger. Of course, this depends on data structure. The combobox RowSource is currently a lookup table? Will probably have to be a join of the lookup table and the target table. The jointype would be 'all records from [lookup table]...' and filter criteria would be under the field from target table of Is Null.

    Otherwise, use DLookup function to check for value in target table and slap user with msgbox if value found, put in BeforeUpdate event.
    How to attach file: 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. User Prompt for multiple Files
    By ratherbgolfing in forum Programming
    Replies: 1
    Last Post: 01-31-2012, 03:38 PM
  2. Prompt User for Date Range when running QUERY
    By taimysho0 in forum Programming
    Replies: 3
    Last Post: 01-30-2012, 11:49 AM
  3. Deleting a ListBox Selection
    By dreamnauta in forum Programming
    Replies: 4
    Last Post: 01-27-2012, 03:14 PM
  4. Cancel Selection Event for ListBox
    By is49460 in forum Forms
    Replies: 2
    Last Post: 08-04-2010, 05:53 PM
  5. Cancel listbox selection
    By vba-dev in forum Access
    Replies: 0
    Last Post: 10-26-2009, 12:18 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 - Senior Forums