Deleted record

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
 
S

Steve Schapel

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?)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top