Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2010

    Unanswered: Add record not working with vb in access

    I am trying to add a record to a table using VB in access but instead of adding the record it just replaces the first record in the table.This is driving me crazy so can someone help me please.It is basically a registration form with 3 fields, UserName, Password, and reenterpassword , and I have a macro that adds a record, it's called "add" and it works perfectly without the 2 commands DoCmd.OpenForm and the command DoCmd.Close.But with these 2 commands it doesn't work for some reaon.
    This is my Code.

    Private Sub Command12_Click()
    If Password = reenterpassword Then
    DoCmd****nMacro "add"
    DoCmd.OpenForm "Register1"
    MsgBox "Please check if you have re-written the password correctly"

    End If

    End Sub

    Can some one please help.
    Thank you

  2. #2
    Join Date
    Oct 2009
    Open the form in which Command12_Click event exist(or the form you are using to add the records), by specifying the data mode

    Consider if it is the Form "Register1", specify the data mode like DoCmd.OpenForm "Register1", , , , acFormAdd

Posting Permissions

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