Delete Record Selected In Combobox

a.sinatra

quik
Local time
, 18:18
Joined
Jan 10, 2004
Messages
262
delete reocrds from combo box

i cant del records from a combo box, its just selects the first in the combo box then it deletes it instead of deleting the one i clicked on, any help would be greatly appreciated! thank you
________
Mercedes-benz clk-class specifications
 
Last edited:
asinatra,

Can't read it.

What version of Access is that? You'd be better off posting an
A97 or A2000 version.

Wayne
 
The form you are using to delete stuff from is unbound so you can't simply delete the current record as it doesn't exist on that form.

All you are doing is putting a query into a combobox. This does not bind it to the form.

Your best bet, from what you seem to have, would be to use DAO to achieve what you want.


Also, I wouldn't advise using text fields as primary keys. i.e. Genre to Genre (in DVD table). It's always advisable to use an Autonumber as it takes up less space and memory.

And be wary of any code that says: DoCmd.DoMenuItem..... as that is obsolete code. Nowadays, we use DoCmd.RunCommand acCmd... syntax. You have the former example on your delete form.
 
If you run a delete Query silently, you need this code on your button's Click event.

Code:
DoCmd.SetWarnings False
DoCmd.OpenQuery "MyDeleteQuery"
DoCmd.SetWarnings True
 
If you want I could post some pure code that would delete the record but it involves using the Database and Recordset Variables
 
AngelicGuardian said:
If you want I could post some pure code that would delete the record but it involves using the Database and Recordset Variables

Along with using DAO and ADO, I was wondering if students, when they hand in projects such as this one, have to justify/explain the code.

If this is the case then it may be that RecordSet objects may be beyond the call of duty.
 
Umm. Could you, im learning right now, and im still going to use my delete query cause thats what i know, but the code would be great
________
Z9
 
Last edited:
a.sinatra said:
Umm. Could you, im learning right now, and im still going to use my delete query cause thats what i know, but the code would be great

Here's a link to explain Recordset objects, DAO, and ADO for you.
 

Users who are viewing this thread

Back
Top Bottom