Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting records 1

Status
Not open for further replies.

GLENEE

Programmer
Feb 9, 2005
64
0
0
GB
I'm trying to delete the records where part of a field will = the value in a drop down box e.g.

DELETE tblReminder.*, tblReminder.memReminder, tblReminder.blnSystemGen
FROM tblReminder WHERE (((tblReminder.memReminder) Like '*[frmDeleteBaseData]![cboRecord]*') AND ((tblReminder.blnSystemGen)=True));

i know it should be deleting 3 records but it doesn't delete any, the problem seems to be the - Like '*[frmDeleteBaseData]![cboRecord]*'
Any help would be appreciated. Thanks
 
Are you trying to do this from code or in a saved query?
Try:
Code:
DELETE tblReminder.*
FROM tblReminder 
WHERE memReminder Like '*' & [frmDeleteBaseData]![cboRecord] & '*' AND blnSystemGen=True;

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
I've tried both ways. By putting the & before and after [frmDeleteBaseData]![cboRecord]the query prompts me for a value even though the form is open and a value has been selected from the drop down box cboRecord.
 
Sorry, I copied and pasted without proofing. Try adding "Forms":
Code:
DELETE tblReminder.*
FROM tblReminder 
WHERE memReminder Like '*' & [red]Forms[/red]![frmDeleteBaseData]![cboRecord] & '*' AND blnSystemGen=True;

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Yea, that's it. The Forms! was missing. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top