Results 1 to 4 of 4
  1. #1
    charu is offline Novice
    Windows 7 Access 2000
    Join Date
    Oct 2010
    Posts
    2

    adding a record to a table using cmd button

    i am finding it difficult to add a record to my access table 'employee' using a command button which i pasted on my form 'employee'. i have written the event code
    Private Sub Add_Record_Click()
    On Error GoTo Err_Add_Record_Click


    DoCmd.GoToRecord , , acNewRec

    Exit_Add_Record_Click:
    Exit Sub

    Err_Add_Record_Click:
    MsgBox Err.Description
    Resume Exit_Add_Record_Click

    End Sub. but this is not working or i am unable to add a record to the table. can any one help me to solve this problem.



  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    does form 'employee' have table 'employee' as its record source?

  3. #3
    michaeljohnh is offline More Human than Human
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    61
    Wouldnt you want the new record command be executed with the OnLoad event for the form not with the button click? And then the OnClick event contain a save record command?

  4. #4
    charu is offline Novice
    Windows 7 Access 2000
    Join Date
    Oct 2010
    Posts
    2
    no. how can i connect the form to this table employee?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Adding table to Query removes every 4th record
    By CoachBarker in forum Queries
    Replies: 1
    Last Post: 10-13-2010, 07:23 AM
  2. Re: Adding a new record to a joined table
    By Mcdodre in forum Access
    Replies: 4
    Last Post: 06-30-2010, 12:07 PM
  3. Updating another record table with command button
    By erlan501 in forum Programming
    Replies: 5
    Last Post: 04-26-2010, 09:03 AM
  4. Replies: 1
    Last Post: 03-29-2010, 04:11 AM
  5. Replies: 6
    Last Post: 02-09-2010, 07:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums