Repost from 9/1 dlookup and delete record

  • Thread starter Thread starter David
  • Start date Start date
D

David

I'm not sure if I explained this well enough or even if
this type of general question is appropriate.

Can someone give me a bit of direction?

-----------------------------
Hello all,
I have a list box on the left side of the page and a
subform that queries table 1 on the right side.
If the user double clicks an item on the list box, it
adds
it to table1 and displays it in the subform/query to the
right. The query displays fields from multiple tables.

The common link (relationship) between the list box,
table1 and the query is Field2. I want to be able to
delete the record in table1 when the user double clicks
the record in the subform/query. I believe I want to use
the dlookup command and then docmd.delete recordset. But
I don't know how to begin to make that happen.

Can someone help me or point me to a sample database that
demonstrates this combination of functions?

Thank you for your help,
David
..
 
David,

If I understand your question correctly, I think this will work...
CurrentDb.Execute "DELETE * FROM Table1 WHERE [Field2]=" & Me.Field2
(... or, if Field2 is a Text data type...)
CurrentDb.Execute "DELETE * FROM Table1 WHERE [Field2]='" & Me.Field2
& "'"
 
Back
Top