473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to append multiple records using a recordset?

547 512MB
I use this code to append one record at a time to a new record in a table and it works 100%. Instead of this, I would like to append all the records currently captured and filtered using the Racename field (as it is happening now), but using a button when i exit the Racesetupf form. In other words, append these records as a batch and not as single records. How do i change this code to accomplish it?

Expand|Select|Wrap|Line Numbers
  1. Dim MyDB As DAO.Database
  2.    Dim rstEntry As DAO.Recordset
  3.  
  4.     Set MyDB = CurrentDb
  5.    Set rstEntry = MyDB.OpenRecordset("RaceEntry2", dbOpenDynaset, dbAppendOnly)
  6.  
  7.     With rstEntry
  8.  
  9.      .AddNew
  10.     ![Racedate] = [Forms]![RaceSetupF]![RaceTimingSF]![Racedate]
  11.     ![RaceName] = [Forms]![RaceSetupF]![RaceTimingSF]![RaceName]
  12.      ![RaceNo] = [Forms]![RaceSetupF]![RaceTimingSF]![RaceNumber] 
  13.  
  14.      'Lap Numbers must be in sync with Field Names in RaceEntry
  15.       .Fields("Lap" & CStr([Forms]![RaceSetupF]![RaceTimingSF]![LapNo])) = [Forms]![RaceSetupF]![RaceTimingSF]![RaceFinishTime]
  16.  
  17.     'The [RaceName] Field in RaceEntry is a LONG, so you must look up the corresponding Value
  18.       ![RaceName] = DLookup("[RaceDetailID]", "RaceDetail", "[RaceName] = '" & [Forms]![RaceSetupF]![RaceName] & "'")
  19.     .update
  20.  
  21.  End With
  22.  
  23.    rstEntry.close
  24.  Set rstEntry = Nothing
Feb 1 '11 #1
0 1131

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Alec Christie | last post by:
Hi All, I currently have 3 tables, Clients, Events and Event Status as follows: Clients: ClientID, Name, Address Events: EventID, Name, Date Event Status: StatusID, EventID, ClientID,...
12
by: shank | last post by:
I'm trying to use online samples for submitting multiple records from ASP into a stored procedure. Failing! Through the below form, a user could be submitting many records at a time. I'm not...
10
by: Roger Withnell | last post by:
I'm using ASP, VBScript and SQL Server. I'm also using UTF-8 character set and so my codepage is 65001 and SQL Server datatype nvarchar. I can insert unicode characters correctly into the...
4
by: Terren | last post by:
Is there a way to create one field from multiple records using sql. For example Table 1 John 18 Peter 18 David 18 Now I want an sql query that when executed will return a field that...
5
by: Kaur | last post by:
Hi, I have been successful copying a vba code from one of your posts on how to copy and paste a record by declaring the desired fields that needs to be copied in form's declaration and creating two...
4
by: felicia | last post by:
Hi All, Below is my code to delete records: adodcAllEntries.Recordset.MoveFirst Do While (adodcAllEntries.Recordset.EOF = False) If adodcAllEntries.Recordset.Fields(0) = selected_id Then...
7
by: flashguy | last post by:
Hi, Looking online for this related topic that will be exclusively used for MS ACCESS (2000 preferably) is extremely limited. Is it possible to add Multiple records with one click of a buttton...
3
madhoriya22
by: madhoriya22 | last post by:
I have solved the problem
1
by: sreenu123 | last post by:
How to insert multiple records into a database table that are entered into a datagridview. With a single shot of Save all the records in the datagridview should be updated using C# . Can any one help...
3
by: uma9 | last post by:
hi, the code below is used to insert a single record....i want to know how to insert multiple records using a "for" loop...please help Set connect = CreateObject ("ADODB.Connection")...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.