Question

  Asked: May 13 2008   1:28 PM GMT
  Asked by: Battler


Overwrite previous record with VBA code


VBA, Excel macros, Microsoft Excel, Visual Basic for Applications

I am doing a training exercise. All works OK as per the notes with a new record being added when the OK button is clicked.

Now I want a script that overwrites the previous record and not to add a new record / row on pressing OK. Pls help with code

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Hello Battler,
you can query your last record (SELECET MAX(ID) as LASTID FROM TABLE) and then perform a DELETE FROM TABLE WHERE ID=LASTID-1.

Bye

Or maybe an UPDATE SQL sentence:
UPDATE theTable SET theName = "Battler Guy" WHERE id = (SELECT MAX(ID) ...)
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development and Microsoft Windows.

Looking for relevant Development Whitepapers? Visit the SearchSQLServer.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register