Deleted record

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

Guest

Hi,
I've a delete button and with the following code on the Click property:

Dim strSQL As String

strSQL = Delete From tblPatient PatientNameID = " & Forms!MainForm!Combo0 &""
CurrentDb.Execute strSQL, dbFailOnError
Me.Combo2.Requery

Everything is function well, but when the name of the patient in the combo
is deleted, the name remains, but is not almost selectable and only when I
close my database and I reopen it, the name is cancelled.
I would like that when I click on the button, the name is cancelles directly
from the list and not only after relaunch the database.
Any idea?
Thanks
Bernd
 
Bernd,

I presume the errors in the code example you gave are typos, and do not
really reflect what you have in your actual procedure? That's one
reason why it is always good to cut/paste code into your newsgroup post,
rather than try to re-type it. :-)

If I understand you correctly, try it like this...

strSQL = "DELETE * FROM tblPatient WHERE PatientNameID='" & Me.Combo0 & ""
CurrentDb.Execute strSQL, dbFailOnError
Me.Combo2 = Null
Me.Combo2.Requery
(assuming PatientNameID is text data type?)
 
Back
Top