Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Me.Howard is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    16

    record deletion


    I have a table whose key is two fields. I am having no luck in selecting a given record from a form and deleting it. No problem in a table with a single field key.
    Any ideas.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Show us some detail.

    Show the record to delete. Its compound key, and the query you have tried.

  3. #3
    Me.Howard is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    16
    The table has two fields JobNbr which has multiple CourseNbr associated with it. The combination of the two is the compound key. (No Duplicates)
    A form with two text boxes, where JobNbr and CourseNbr are entered for selection of the record to be deleted.
    The delete query is as follows:
    JobNbr CourseNbr
    Requirement Table Requirement Table
    Where Where
    [Forms]![FrmRequirementDelete]![JobNbr] [Forms]![FrmRequirementDelete]![CourseNbr]

    When the query executes it deletes the first record that matches the JobNbr ignoring the matching CourseNbr
    I hope this explains the situation.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Please show
    -the table design with the compound PK
    -the sql of the delete query.

  5. #5
    Me.Howard is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    16
    Quote Originally Posted by orange View Post
    Please show
    -the table design with the compound PK
    -the sql of the delete query.
    DELETE [Requirement Table].[Job Nbr], [Requirement Table].[Course Nbr]
    FROM [Requirement Table]
    WHERE ((([Requirement Table].[Job Nbr])=[Forms]![FrmRequirementDelete]![JobNumber]) AND (([Requirement Table].[Course Nbr])=[Forms]![FrmRequirementDelete]![CourseNumber]));

    Job Nbr = Number
    Course Nbr = Number

    Job
    Field Size = Long Integer
    Validation Rule = Between 1000 and 10000
    Required = Yes
    Indexed = Yes (No Duplicates)

    Course
    Field Size = Long Integer
    Validation Rule = Between 100 and 1000
    Required = Yes
    Indexed = No

    Could the index on the course be an issue?

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    A DELETE query DELETES records not fields.

    Format is DELETE FROM table_name
    WHERE some_column=some_value;


    http://www.w3schools.com/sql/sql_delete.asp


    Can you show a jpg of your table design?

  7. #7
    Me.Howard is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    16
    There are only 2 fields in the requirements record.
    How do I get a jpeg of the query design?

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Go to table design view and do a printscrn. That should save a copy of the screen to a copy/paste buffer.
    Then go to a graphics image program (like Paint/irfanView...) and paste a new image. Then save the file, and attach to a post.

  9. #9
    Me.Howard is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    16
    I have the jpeg but I see no wY TO ATTACH IT TO THE POST. iT WONT CLICK AND DRAG OR COPY AND PASTE.

  10. #10
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Click on the "Go Advanced" button at the bottom of your post. Scroll down until you see the manage attachments button. Click the button. Follow prompts..

    Or you can click on the "Insert Image" icon in the message tool bar. Follow the prompts...

  11. #11
    Me.Howard is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    16
    Click image for larger version. 

Name:	req table 3.JPG 
Views:	11 
Size:	33.6 KB 
ID:	22464Click image for larger version. 

Name:	req table 2.JPG 
Views:	11 
Size:	55.1 KB 
ID:	22463Click image for larger version. 

Name:	req table 1.JPG 
Views:	11 
Size:	56.2 KB 
ID:	22462Thanks I appreciate the help.

  12. #12
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Your design shows an inconsistency to me.
    I see a Primary Key indicator on each of Job Nbr and Course Nbr. But I also see that Job Nbr shows Indexed duplicates OK (that is not consistent with a PK) and Course Nbr is not indexed.

    If you go to table design, what does it show when you click on Indexes?
    Attached Thumbnails Attached Thumbnails IndexesOnTableDesign..jpg  

  13. #13
    Me.Howard is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    16
    Click image for larger version. 

Name:	capture20151023064836851.png 
Views:	7 
Size:	10.8 KB 
ID:	22473Index shown
    Attached Thumbnails Attached Thumbnails capture20151023063906817.png  

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

  15. #15
    Me.Howard is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    16
    I cant share the database as it contains personal information. It is a hospital application and subject to HIPA rules.

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

Similar Threads

  1. Replies: 4
    Last Post: 11-21-2013, 10:05 AM
  2. Replies: 3
    Last Post: 05-29-2013, 02:34 PM
  3. Deletion not done due to Error 3086
    By hklein in forum Access
    Replies: 2
    Last Post: 05-02-2012, 02:46 PM
  4. deletion with join
    By hklein in forum Queries
    Replies: 5
    Last Post: 05-01-2012, 03:41 PM
  5. Time Stamp Removal/deletion?
    By thorsonb in forum Access
    Replies: 3
    Last Post: 03-30-2010, 10:17 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