Remove Code Not working... any ideas?

woodman650

Always confused.
Local time
Yesterday, 19:46
Joined
Jan 22, 2005
Messages
55
Hey all,
I'm trying to delete a record in a table by selecting a value in a list box and hitting a command button to delete the associated record. Here is what I am using:

Code:
Private Sub DeleteMovie_Click()
CurrentDb.Execute "Delete from " & _
"tblFinance " & _
"where TransactionID = """ & Me.TransList & """", dbFailOnError

Me.Requery
Me.TransList.Requery
Me.TransList = ""
End Sub

However, nothing happens. the record isn't deleted, I get no errors... nothing. Any ideas why this may not be working with the listbox? thanks in advance! =)
 
Do i tthis way:

DIm sql as String

sql = "Delete from tblFinance where TransactionID = '" & Me.TransList & "'"
Docmd.Runsql sql
Me.Requery
 
hmm... doesn't want to work. still having the same problem. nothing happens. I have other values in the listbox with the TransactionID, would that conflict?
 
Have you any related records For TransactionID In other tables and what are there relationships IE Cascade Delete, Ref Integrity Act
 
is TransactionID actually a text field not a numeric field?

use
debug.print sql
to make sure what you are actually getting

HTH

Peter
 
it is actually an autonumber field. does that change anything?

I put the debug code in but I don't know where it prints the result or how to run the debug procedure.
 
If it's a numeric field, you don't want the quotes around it. Try:

"where TransactionID = " & Me.TransList, dbFailOnError
 
haha, a simple fix! awww, I wish I was better with code. thanks Paul, greatly appreciated!
 

Users who are viewing this thread

Back
Top Bottom