0

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.

Edited by mike_2000_17: Fixed formatting

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Bashir ahmad
0

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

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.