Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52

    Duplicate data results

    I have a form linked to SQL Server table, it has a search box that applies a filter when you click search or hit enter. The data is correct on the server table. Simple in theory , but when the results are returned they aren't correct! Sql has the below but the search returns 3 lines but all are comments "testing". Driving me nuts, what am I doing wrong? Note it's a simple split form.



    Id | name | Comments
    1234 | Smith | testing
    1234 | Smith | testing2
    1234 | Smith | testing3

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Show the sql of the form's recordsource and any filter you have.

  3. #3
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52
    The record source is just the table name and the only filter that is applied is what's typed in the text box, it searches f name, l name and ID

  4. #4
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52
    Lol Ike I just chose it from a drop down

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I have no idea what this thread is about. Perhaps "split form" has something to do with the symptom.

  6. #6
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52
    Quote Originally Posted by ItsMe View Post
    I have no idea what this thread is about. Perhaps "split form" has something to do with the symptom.
    What specifically is confusing?

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    You are seemingly getting a Cartesian effect from a table after applying a keyword to a form's Filter property. That does not add up. So, there is not a single thing that makes perfect sense. The one exception may be the Split Form thing. When you put everything together, it makes less sense.

  8. #8
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52
    I see. Here is the filter that is applied via "Apply Filter" macro on click event:
    [ID] Like "*" & [Forms]![frmLookup]![txtSearch] & "*" OR [Last Name] Like "*" & [Forms]![frmLookup]![txtSearch] & "*" OR [First Name] Like "*" & [Forms]![frmLookup]![txtSearch] & "*"

    After that filter it applies a sort order by 4 fields using the same macro and "Set Order By"

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Apparently there are three records with "testing". Maybe you can display the Primary Key during runtime and determine which records are actually being displayed.

  10. #10
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52
    Interesting update, the linked Sql Server table has the duplicate records in it, however the actual SQL table does not have dup records. What?!

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Hmmmm. Maybe you can collect the connection property information from design view of your table and also the table name and rebuild it. Delete the table and use something like the following to add it back. If it persists, you may need to export dependent Objects for safe keeping, delete the dependent objects, then do a compact and repair. In other words, do a C and R after deleting the objects.
    https://www.accessforums.net/showthr...522#post298522

  12. #12
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52
    I used a File DSN to connect using trusted windows authentication ont he table. Interestingly, I have compacted and repaired this DB today. I did not notice this problem prior to that, not saying it did not exist though.

  13. #13
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    The compact and repair may have introduced an issue. So, rebuilding the table may be as easy as using the Wizard for you. However, there may be issues with a dependent query object or something. So deleting the culprit object and purging the system tables via a C and R may be the only solution. Of course, this is only a guess. I seem to remember a similar issue being reported. However, I am not remembering the cause.

  14. #14
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52
    sooooo, semi rookie mistake. I fancy myself an average user of access and average on sql server. When I created the SQL table, I did not introduce or create auto numbered PK. Earlier today when I linked to the SQL table via ODBC in MS Access, I was asked to choose a unique identifier on the last step, so I chose the ID/"case id" mentioned above in my post. I see now it was a bit misleading in my post, I was trying to not divulge company info and in the process failed in my attempt to seek help...sigh.

    That is where the issue was, I went back and dropped and recreated the sql table and added an auto numbering PK....then deleted the linked table, readded the new and improved version with PK and viola! It did not ask me for a unique ID upon running the wizard! After testing, it appears that the search is working as intended now. I guess the case ID being the ID messed with the results, ill try and wrap my brain around the logic of that specifically later on.

    I wanted to make sure to post this in case someone else has a bonehead moment like me. Moral is, add a PK when linking to a table in sql.

    Cheers!

  15. #15
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Ok, thanks for posting and glad you are moving forward. I am unfamiliar with the Wizard and I am not sure I understand the adding PK thing. But, I cannot imagine adding one will hurt. I am just curious why Access has that option.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Delete duplicate records and unite results
    By rndmxy2k13 in forum Access
    Replies: 1
    Last Post: 09-24-2013, 04:21 AM
  2. Replies: 3
    Last Post: 05-01-2013, 09:52 AM
  3. Eliminate Duplicate (mirrored) Results
    By fauowls in forum Access
    Replies: 3
    Last Post: 03-21-2013, 03:39 PM
  4. Replies: 3
    Last Post: 03-01-2013, 12:41 PM
  5. Suppressing duplicate results
    By jonesy29847 in forum Reports
    Replies: 5
    Last Post: 04-22-2010, 12:43 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