deleteing query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how can i delete all records in a table where the description starts with a
specific letter?
 
First Back up your MDB, so you can recover the data

You can try a Delete query with Like and wild card (*)

Delete TableName.* From TableName Where FieldName Like [Please select a
letter] & "*"

When the query run the user will be prompt with a message [Please select a
letter], and the query will delete all the records that the a specific field
start with this letter.
 
As Ofer Cohen said BACK UP YOUR DATA first.

If you should fail to enter a letter you could end up deleting every record
in your database that has a value in the field.

I would at least modify the WHERE clause of the query to

WHERE FieldName LIKE [Please Select a Letter] & IIF(IsNull([Please Select
a Letter]),"","*")

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Ofer Cohen said:
First Back up your MDB, so you can recover the data

You can try a Delete query with Like and wild card (*)

Delete TableName.* From TableName Where FieldName Like [Please select a
letter] & "*"

When the query run the user will be prompt with a message [Please select a
letter], and the query will delete all the records that the a specific
field
start with this letter.


--
Good Luck
BS"D


h115x said:
how can i delete all records in a table where the description starts with
a
specific letter?
 
Thanks John,
It's a very good point



John Spencer said:
As Ofer Cohen said BACK UP YOUR DATA first.

If you should fail to enter a letter you could end up deleting every record
in your database that has a value in the field.

I would at least modify the WHERE clause of the query to

WHERE FieldName LIKE [Please Select a Letter] & IIF(IsNull([Please Select
a Letter]),"","*")

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Ofer Cohen said:
First Back up your MDB, so you can recover the data

You can try a Delete query with Like and wild card (*)

Delete TableName.* From TableName Where FieldName Like [Please select a
letter] & "*"

When the query run the user will be prompt with a message [Please select a
letter], and the query will delete all the records that the a specific
field
start with this letter.


--
Good Luck
BS"D


h115x said:
how can i delete all records in a table where the description starts with
a
specific letter?
 
Back
Top