Results 1 to 4 of 4
  1. #1
    exo is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    28

    "Find Record" button keeps creating new records

    Using a simple example, say I have a database full of employees.

    On the main start-up form I have a button to find an employee by last name. Say there is a record with the following info:

    First Last Extension Email
    Jack Brown 1111 Jack_Brown@email.com

    To make the front form look clean I have it set to go to a new record - this makes the "find employee" section blank rather then showing the first last name in the database. The problem is since I have defined a new record to make it blank, it then tries to write whatever i have in that box to a new record. So If I search "Brown" it will work, but when i close the form it will write a new record. Here is an example.

    First Last Extension Email
    Jack Brown 1111 Jack_Brown@email.com


    Brown

    It makes a new record and populates the last name with what I searched for. I attempted to solve this by setting the primary key as the email address. But now it still tries to make a new record, but pops an error up stating that the primary key can not be null.

    So how do I have a blank form (in other words, not pre-populated with the first last name) without creating a new record? I considered having a blank record first, but then I would have to write queries to exclude that blank record from every report and such.

    Thanks for any suggestions.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    New records will *not* be created unless you Dirty that record. I would examine how you are taking the input and looking up the record.

  3. #3
    exo is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    28
    Quote Originally Posted by RuralGuy View Post
    New records will *not* be created unless you Dirty that record. I would examine how you are taking the input and looking up the record.
    Well, using the button wizard I choose the "find record" button and I base it on the user's last name.

    This creates a text input box with a button next to it that says find.

    I then have to link the form to the table I want to find last names from.

    Now I see the first users last name in the find box.

    To prevent seeing the users last name I had it set to go to a new record every time I open the form.

    So now when I open the form I have a blank next to "Search by Last Name" instead of the first last name in the database.

    The problem is, when I type a last name there, such as Brown, it has typed that name into the new record. So when i hit search it brings up a new form with the proper record, but when i close the main form (with the find function on it) it tries to save the new record because I have typed Brown into it.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why don't you try the ComboBox wizard and select #3 and see if you like it.

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

Similar Threads

  1. Creating "Edit Record" link in table column
    By joshearl in forum Forms
    Replies: 1
    Last Post: 12-25-2009, 11:17 AM
  2. Error message and How do I find the "value Field" ?
    By createdwithfire in forum Forms
    Replies: 1
    Last Post: 11-05-2009, 12:26 PM
  3. "doCmd - can't find object"
    By drmcfall in forum Access
    Replies: 1
    Last Post: 08-18-2009, 09:41 PM
  4. Create "reset filter" button
    By vanlanjl in forum Access
    Replies: 0
    Last Post: 03-03-2009, 07:36 AM
  5. "Previous Month" button
    By allochthonous in forum Programming
    Replies: 3
    Last Post: 09-10-2006, 12:15 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