PC Review


Reply
Thread Tools Rate Thread

Adding a record to a table

 
 
Jim Pockmire
Guest
Posts: n/a
 
      6th May 2006
Is there an easier way to add a record to a table, than using the code
below?

Sub AddToMyReports()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("MyReports")
rs.MoveLast
rs.AddNew
rs!USER_CODE = "03JIMP1"
rs!RptCode = "99999"
rs.Update
End Sub


 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      6th May 2006
You can use append query:

CurrentDB.Execute "Insert into MyReports (USER_CODE, RptCode)
Values('03JIMP1','99999')"

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com


"Jim Pockmire" <(E-Mail Removed)> wrote in message
newsc57g.7285$(E-Mail Removed)...
> Is there an easier way to add a record to a table, than using the code
> below?
>
> Sub AddToMyReports()
> Dim db As DAO.Database
> Dim rs As DAO.Recordset
> Set db = CurrentDb
> Set rs = db.OpenRecordset("MyReports")
> rs.MoveLast
> rs.AddNew
> rs!USER_CODE = "03JIMP1"
> rs!RptCode = "99999"
> rs.Update
> End Sub
>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Adding a record to a table Ken Snell Microsoft Access VBA Modules 1 23rd Feb 2010 04:26 AM
Adding detail to record in a table in a secondary table ramudo Microsoft Access 1 16th Jan 2010 12:32 AM
Problem adding new record to table via form - error 2105 "You can'tgo to the specified record" Martin Microsoft Access Forms 1 26th Aug 2009 02:57 PM
adding a record from one table to another =?Utf-8?B?Q3liZXJ3b2xm?= Microsoft Access VBA Modules 0 27th Sep 2006 08:30 PM
REQ Help: Adding record to a table that is related to a selected record Peppie Microsoft Access Macros 4 30th Aug 2006 11:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:15 AM.