Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 401
  • Last Modified:

Insert Blank Row

Simple question but I am too burnt out today to remember the simple answer.  How can you insert a blank row into an access table.  My table is called tmpMigration2 and I want to do this in the VBA.
1 Solution

You can't "insert" in tables, only "append". And normally, you can't have a "blank" row, as one field at least should contain something -- e.g. the  key field.

Perhaps you meant: in a report? Or did you mean: how to add a new record in a table using VB?

Jeffrey CoachmanMIS LiasonCommented:

harfang is correct.

Can you explain why you need this blank Record?

I mean, you could very well insert a null into one of the fields, than save the record.
In effect creating a Blank Record.
Like so:

Private Sub cmdInsertBlank_Click()
    'Creates a new record
    DoCmd.GoToRecord , , acNewRec
    'Inserts a Null in one Field
    Me.AnyFieldInYourForm = Null
    'Saves the record
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    'Displays a message after inserting the blank record,
    'so the user won't think it is a "New" record, and start entering data.
    MsgBox "Here is your Blank Record"
End Sub

But this is non-standard and might cause problems.

But again, Why do you need this functionality?

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now