Syntax Issues

ijit

Registered User.
Local time
Today, 14:43
Joined
Oct 17, 2007
Messages
15
Hey, I am still learning the syntax in VB. This is saying that the types don't match up.

Code:
CurrentDb.Execute "DELETE * FROM ItemList WHERE ([ItemKey]= & Me.ItemKey & )"
ItemKey is a number. How would I write this?
 
The form reference needs to be outside the quotes so it can be evaluated:

CurrentDb.Execute "DELETE * FROM ItemList WHERE ([ItemKey]=" & Me.ItemKey & ")"
 
It worked perfectly, thanks.
 
No problem; by the way, the parentheses around the WHERE clause are not necessary. This should work equally well:

CurrentDb.Execute "DELETE * FROM ItemList WHERE [ItemKey]=" & Me.ItemKey
 

Users who are viewing this thread

Back
Top Bottom