Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Posts
    89

    Unanswered: Delete Query help

    Hi

    If made a database that registers when, to who, and what bike number is given out.

    Now i want that if a bike with a certain number is given out, it will not be possible to give it out again,,, until it has returned of course.

    I have used a Primary Key on the 1e table to make sure that only 1 number is in the list.
    Once the bike has been registered as returned it adds the info to the 2e table, and also an delete query to delete it out of the first table so the bike can be given out again.

    But the problem is that the delete query only deletes the content of the whole table or the criteria of the delete query.

    So my question is:
    Is there a way to set the delete query to delete a certain record????
    To of course the bike that is being returned...

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    put a WHERE clause on the delete statement. A WHERE clause acts as a filter.
    it can be used on SELECT and DELETE statements

    eg
    SELECT My, Column, List from MyTable
    WHERE ANumericValue = 99
    AND AStringValue = 'Blah'
    AND ADateValue = '#08/21/2012#'
    that would retrieve any records whose column values matches all 3 specificedvalues

    the exact same WHERE clasue be used in a delete statement
    Microsoft Access Delete Query, SQL Syntax, Examples and Errors

    WHERE criteria don't need to be =
    but they do need to resolve to a boolean value, the underpinning of a where clause
    a where clause could contain OR

    eg-
    WHERE ANumericColumn = 96 or ANumeric Column = 52
    ..ie if the value in ANumericColumn id either 96 or 52, process the row, obviously you couldn't use an AND in this instance as ANumericColumn couldn't be equal to both values
    WHERE ANumericColumn < 100
    ..ie if the value in ANumericColumn is less than 100, process the row
    WHERE ANumericColumn >= 0
    ..ie if the value in ANumericColumn id greater than or equal to 0, process the row

    WHERE ANumericColumn <> 0
    ..ie if the value in ANumericColumn is not equal to 0, process the row
    WHERE AStringColumn LIKE "Rubber*"
    if the value of AStringColumn matches the 'Rubber' (ie match the first 6 characters)
    and so on...
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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