Adding new record from form

hollyneal

Registered User.
Local time
Today, 05:49
Joined
Jan 5, 2012
Messages
21
I am extremely new and trying to teach myself Access. I've created a form called New Call with several fields and added a button that says, "New Record." I thought I could just do a macro to get the form to blank out and accept input when the user hit the button but there's no method on the list for an action to add a new record.

So I went into visual basic and I'm not having much luck.

All I want is when the user hits the New Record button, the form clears and the user will enter the information into the text boxes and hit update or enter or something and it adds a record to the database.

Here's what I've used so far:

Private Sub NewRecord_Click()

Set Varset = CurrentDb.OpenRecordset("Select Tracking.* FROM Level2;", 2)
Varset.AddNew
Varset!Call_Type = Me![Call Type]
Varset!Call_Date = Me![Date]
Varset!UW_Name = Me![UW Name]
Varset!Agt_Name = Me![Agt Name]
Varset!Agt_Number = Me![Agt Number]
Varset!Quote_Number = Me![Quote Number]
Varset!LOB = Me![LOB]
Varset!Notes = Me![Notes]
Varset.Update

End Sub

But it doesn't work.
 
If the form is bound to table then any data entered/edited will be saved just by moving to a new record.
 
Thanks Bob. I'm sorry for the ridiculous way I posted that. My real problem is that I want to get a button to do the move to a new record part. The only way I've figured out to get to a new record when on a form is the little teeny arrow at the bottom. Is there a better way?
 
Create a button with the wizard to Add New Record.

Or paste this:
Code:
DoCmd.GoToRecord , , acNewRec
into the click event code of a button.
 

Users who are viewing this thread

Back
Top Bottom