# delete statement

The delete statement removes a specific
item from a file.

## Syntax

```
delete {file.var}, ID.exp{on.error.clause}
```

## Parameter(s)

| file.var | File from which the specified item will be deleted. |
| --- | --- |
| ID.exp | Item to delete. |
| on.error.clause | Consists of text on error followed by a statement list. |

## Description

The *on.error.clause* is taken if the update fails due to a lost network connection or
a callx that executes an inputerr statement.

## Example(s)

This program deletes a specific
item from the `customer.file`. `yes` is the only valid answer to perform the delete.

```
open ’customer’ to customer.file else stop 201,’customer’
input customer-ID
crt ’are you sure? ’:
input ans
if ans = ’yes’ then delete customer.file,customer-ID
```

## See also

- [Default File Variables](https://d3codex.com/pickbasic-flashbasic/default-file-variables/)
- [delete() function](https://d3codex.com/pickbasic-flashbasic/delete-function/)
- [File variable](https://d3codex.com/pickbasic-flashbasic/file-variable/)
- [ID expression](https://d3codex.com/pickbasic-flashbasic/id-expression/)
- [inputerr statement](https://d3codex.com/pickbasic-flashbasic/inputerr-statement/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)

---
Source: https://d3codex.com/pickbasic-flashbasic/delete-statement/ - part of the D3Codex reference.
