I am usig VB6 & Access 2000 to create a program for a clinic to store patient details.
I want to check whether a record with same date exists and if exists delete it and save new details.but with my coding it is not deleted even if the record exists.

chkdate=format(dtpicker1.value,"dd/mm/yyyy")
adconn1.execute "Delete from Patient_Det where ID='" &txtId.text& "' and CheckupDate=Cdate(#" & chkdate & "#)"

please help.

Recommended Answers

All 2 Replies

I think you will find that SQL uses the american date format mm/dd/yyyy, I usually find it safer to use dd-mmm-yyyy eg 14-jun-2010

U may use the following

adodc1.recordsource="select * from table1 where id=" & txtid & " and date=#" & txtdate & "#"
adodc1.refresh
if adodc1.recordset.recordcount>0 then
adodc1.recordset.delete
end if

hope it will help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.