var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: deleting problem
why is it that when i delete a record the first record is deleted not the one that is in the combobox and name?
i have a combobox customerid to choose and when i click delete the id is not followed the first record in the table is deleted...
Private Sub accept_Click()
DoCmd.RunSQL "delete from customer where customerid=cmbcustomerid and name=txtname;"
The SQL is wrong I think. I'm not sure because I don't really use the Run SQL command but try this anyway:
DoCmd.RunSQL "delete from customer where customerid= '" & cmbcustomerid "' and name= '" & txtname & "';"
DoCmd.RunSQL "delete from customer where customerid= [Forms]![FormName]![cmbcustomerid] and name= [Forms]![FormName]![txtname];"
Last edited by dwil2g1; 06-17-04 at 14:47.
Originally Posted by oeuf85
Try this...comes right from my database that Deletes the record and then requeries the form and control.
Private Sub cmbDeleteRecord_Click()
On Error GoTo Err_cmbDeleteRecord_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.RunSQL "DELETE * FROM customer WHERE customerid= " & [Forms]![FormName]![cmbcustomerid] & "AND name= '" & [Forms]![FormName]![txtname] &"';"