+ Reply to Thread
Results 1 to 7 of 7

Goto Record when Duplicate Record Exists

  1. #1
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Goto Record when Duplicate Record Exists

    Currently have a database with 3 fields set as primary key so that duplicates will not be saved. I also inserted an On error message below to display an error message. The final step would be to take the user to the already existing record. Any ideas on how to accomplish this? Is there some code that I could add to the on error message to take the use to the already existing record. The three fields are Loan_Number, Investor_Number and Request_Type. Thanks for the help.

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    03-14-2012
    Location
    Arizona USA
    MS-Off Ver
    Excel 2000/2007
    Posts
    408

    Re: Goto Record when Duplicate Record Exists

    The only thing needed is the sheet name and the cell address.

    Sheets("sheetname").Select
    Range("celladdress").Select

  3. #3
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: Goto Record when Duplicate Record Exists

    I forgot to mention that this is an access form refrencing a database. How would I be able to go to the record in this case? Thanks

  4. #4
    Forum Contributor
    Join Date
    04-23-2009
    Location
    IOWA
    MS-Off Ver
    2010 Professional
    Posts
    270

    Re: Goto Record when Duplicate Record Exists

    rlsublime,
    Since I don't have long, gonna give you a short answer. This can be accomplished. The way that I personally would accomplish this is to avoid the error completely. I would have the 3 primary key fields on the form unbound, parse the data entered to see if it already exists. If it does load the rest of the data, if it doesn't then create a new record and enable the rest of the fields on the form.

    If you need some more assistance on this let me know.

    Hope this helps,
    Dan
    "I am not a rocket scientist, I am a nuclear engineer." - Split_atom18
    If my advice has been helpful to you, then please help me by clicking on the "Star" and adding to my reputation, Thanks!

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Goto Record when Duplicate Record Exists

    Dennis,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Goto Record when Duplicate Record Exists

    Quote Originally Posted by Dennis7849 View Post
    The only thing needed is the sheet name and the cell address.

    Sheets("sheetname").Select
    Range("celladdress").Select
    Access? That looks like Excel VBA to me, in which case I would use GoTo if I really needed to select a sheet/range
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Forum Contributor
    Join Date
    04-23-2009
    Location
    IOWA
    MS-Off Ver
    2010 Professional
    Posts
    270

    Re: Goto Record when Duplicate Record Exists

    Dennis was a reply not the OP. His answer was for excel the OP is in Access.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1