Results 1 to 10 of 10
  1. #1
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231

    Delete Record from Datasheet

    I'm using Martin Greene's audit table program and have it functioning for any edits or new records with a datasheet subform inside a main form. The program is called via the BeforeUpdate event.

    But when I delete a record from one of the datasheet fields, the useraction "EDIT" does not catch the delete even though it compares .oldvalue to value.

    Is there another event that I should be triggered to catch deletes?

    CementCarver

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Isn't there a Before Delete event?

  3. #3
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231
    There is, but when I associated the delete event to my module, it didn't do anything ie. tracking the delete.

    CementCarver

  4. #4
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231
    RuralGuy,

    After stepping through the code, my debug statement gives me this:

    Original Fiscal Year Value is :9/20/2013
    And the new one coming in is :

    So, then why doesn't this line of code catch this: If FiscalYear_new <> FiscalYear_old Then ????????????
    Can you do such a comparison with a null value?

    CementCarver

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Nulls are strange and *never* equal to anything including another null. Try using the Nz() function to fix that.

  6. #6
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231
    RuralGuy, I tried this line too, but it still doesn't catch the deleted record...."If Nz(FiscalYear_new) <> Nz(FiscalYear_old) Then"

    CementCarver

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    How about:
    If Nz(FiscalYear_new,"") <> Nz(FiscalYear_old,"") Then

  8. #8
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231
    Same thing happens..... it doesn't even catch the deleted record from one of the fields.

    CementCarver

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    I do not know Martin Greene's audit table program so I am only guessing at the problem. Sorry.

  10. #10
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231
    Thanks for your help anyways.... appreciate it.....CementCarver

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

Similar Threads

  1. Replies: 4
    Last Post: 07-03-2013, 10:02 AM
  2. Replies: 3
    Last Post: 10-19-2012, 04:30 PM
  3. Replies: 8
    Last Post: 08-26-2012, 11:11 PM
  4. Trying to Delete record using delete query
    By MooseOTL in forum Access
    Replies: 13
    Last Post: 10-04-2011, 02:30 AM
  5. Replies: 38
    Last Post: 05-21-2010, 11:56 AM

Tags for this Thread

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