Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Record to table 1 shot

Status
Not open for further replies.

craiogram

MIS
Feb 20, 2004
126
0
0
US
I understand that I can insert a record into a table such as:
DoCmd.Run SQL "INSERT INTO tblName ([Fname],[Lname],[Bday]) Values ('Martin', 'Green', #09/27/1950#);"

However I do have a LOT of fields in the span of a 2 page form. How can I do it so that all fields are inserted in table as a record. Thank you!!
 
Hi

You could do it by opening a recordset........

Dim db As DAO.DataBase
Dim rs As DAO.RecordSet

Set db = CurrentDB()
Set rs = db.OpenRecordSet("YourTableName")

rs.AddNew

rs("FirstName") = Me.FName
rs("LastName") = Me.LName
etc..........

rs.UpDate

Set db = Nothing
Set rs = Nothing

HTH
 
...Or create a form based on the table requiring the information. Enter the data into the form.

...Or, if you have the data in a spreadsheet, you can import the data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top