Results 1 to 8 of 8
  1. #1
    IannWard is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    16

    Zero return on delete query

    Hi All

    I'm a newbie learning access. I have created a query to delete an entry in a field, when I enter a value that I know does not exist, it prompts me to delete '0' entries. Can I add a message box that informs me that the value does not exist in the table?



    Many Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I am confused. If you know the value does not exist why are you using it?

    What do you mean by 'delete an entry in a field'? Are you deleting a record or changing value in a field?

    Show your code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    IannWard is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    16
    Quote Originally Posted by June7 View Post
    I am confused. If you know the value does not exist why are you using it?

    What do you mean by 'delete an entry in a field'? Are you deleting a record or changing value in a field?

    Show your code.
    For example, if a user record has already been deleted, and I try to delete them it tells me that there is no record to delete. This is obvious, I know, but just wondered why access doesn't just say 'record does not exist' or something.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Doesn't "No record to delete" have the same meaning as "record does not exist"?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    IannWard is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    16
    Well of course it does. I guess I was thinking if there was a way to change the message to a custom message like in a validation rule for example.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I would validate the input before allowing the delete action. Then can popup a MsgBox with whatever you want to say.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    IannWard is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    16
    That's kinda what I was thinking, unfortunately, I haven't quite got to grips with validation rules yet, they look a bit complicated to me. Any help would be grateful..

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    One approach is to do a DLookup on the table.

    If IsNull(DLookup("fieldname", "tablename", "fieldname=" & Me.tbxInput)) Then
    MsgBox "No record"
    Else
    'code to delete record
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 7
    Last Post: 11-08-2013, 03:34 AM
  2. Replies: 5
    Last Post: 05-01-2013, 11:39 AM
  3. Replies: 2
    Last Post: 01-24-2012, 02:16 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: 11
    Last Post: 03-30-2011, 01:08 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