Very Desperate!

I'm trying to write code in VBA/part of autocad that would: if the user wanted to plot say a polyline, if he moved the polyline around the drawing, the attributes(x,y,z) would be sent to the database. any ideas on writing this code, i'm a newbe at this and not sure where to start.