Results 1 to 4 of 4

Thread: Delete a row

  1. #1
    Join Date
    Nov 2006
    Posts
    13

    Unanswered: Delete a row

    Hello,

    I need the code to delete the first row in my table.

    If you must know- the data table has 2 headings, so i need to delete the other.

    Thanks in advance,

    John

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    This post has been sitting here like the 800 pound gorilla at the cocktail party for half a day now and nobody's responded, so I'll jump in with the obvious question (and no, it's not why you need to delete it!)

    Why can't you simply go into the table proper, select the row and delete it?
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Nov 2006
    Posts
    13
    stupid gorilla! start making friends...

    anyways, I need this to be automatically done because I have a GUI where the user can only do a few specific tasks, and that doesnt include deleting my data. When they choose to import this file (the only file they can really can really import), the file has two rows of headings. When i have it set to TRUE that the first row is heading names, it still leaves me with one row of headings.

    To give any ideas, I have the code to delete the entire database
    CurrentDb().Execute "DELETE * FROM []

    Maybe that will give ideas

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Code:
    Private Sub Form_Load()
      DoCmd.GoToRecord , , acFirst
    End Sub
    or

    Code:
    Private Sub Form_Load()
      DoCmd.GoToRecord , , acNext
    End Sub
    should take you to the correct row (I'm not sure what's considered the "first" row when you have it set to TRUE that the first row is heading names) and then you should be able to delete the offending duplicate! The question is, after importing the file, will the form be opened just the one time and everything processed and then closed, or is it apt to be opened a number of times. If it's opened just once after importing, you can simply put the deletion code after the DoCmd.GoToRecord in the Form_Load sub. If it will be opened more than once after importing, you need to figure a way to execute the deletion code only once.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •