473,405 Members | 2,354 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,405 software developers and data experts.

Multple record entry

68
I have a situation whereby I have to enter many records in a db that only have one field that changes. For example software installed on a computer would give you many different rows of data with just a single variant in the software field.

I want to know if it is possible to have my form setup in such a way that it takes one instance of constant data and various instances of a variant field but for each variant create a new record and add it to the table

For example it would take the machine name entered only once by the user and add it with every software that the user selects. I am thinking here of a subform in datasheet view that allows u to enter multple records. All records must be entered in the same table

thanks experts
Jul 16 '09 #1
5 1850
ADezii
8,834 Expert 8TB
@KingKen
This would be a simple matter using DAO and a Looping Structure. Let's assume that your Table Name is Table1, and that it consists of 4 Fields named Field1, Field2, Field3, and Field4. The following code will Append 10 Records to Table1 keeping Field1, Field2, and Field3 constant while making Field4 variable.
Expand|Select|Wrap|Line Numbers
  1. Dim MyDB As DAO.Database
  2. Dim rstTest As DAO.Recordset
  3. Dim intTestCounter As Integer
  4.  
  5. Set MyDB = CurrentDb
  6. Set rstTest = MyDB.OpenRecordset("Table1", dbOpenDynaset, dbAppendOnly)
  7.  
  8. With rstTest
  9.   For intTestCounter = 1 To 10
  10.       .AddNew
  11.         ![Field1] = "Yada"
  12.         ![Field2] = "YadaYada"
  13.         ![Field3] = "YadaYadaYada"
  14.         ![Field4] = (intTestCounter ^ 2)
  15.       .Update
  16.   Next
  17. End With
  18.  
  19. rstTest.Close
  20. Set rstTest = Nothing
Table1 after code execution:
Expand|Select|Wrap|Line Numbers
  1. Field1    Field2      Field3         Field4
  2. Yada      YadaYada    YadaYadaYada      1
  3. Yada      YadaYada    YadaYadaYada      4
  4. Yada      YadaYada    YadaYadaYada      9
  5. Yada      YadaYada    YadaYadaYada     16
  6. Yada      YadaYada    YadaYadaYada     25
  7. Yada      YadaYada    YadaYadaYada     36
  8. Yada      YadaYada    YadaYadaYada     49
  9. Yada      YadaYada    YadaYadaYada     64
  10. Yada      YadaYada    YadaYadaYada     81
  11. Yada      YadaYada    YadaYadaYada    100
  12.  
P.S. - It appears as though you may want to take a look at the following Article.
Jul 16 '09 #2
KingKen
68
I should have mentioned that I am working in microsoft Access 2003. All the forms are in access. Would this approach work there too?

I can't see the link that you are pointing me to please repost.

How about the subform aproach can it work in Access? if so how?
Jul 17 '09 #3
ajalwaysus
266 Expert 100+
Yes, this can be done in Access 2003.

As to using a subform, you can, by using Master - Child linking between the Parent form and subform, and only link on the constant fields.
Display all your constant fields on your parent form, and only those that change on the subform. This way you can add as many records as you want on the subform and it will automatically inherit the constants from the parent form. This will work even if you have more than one filed you wish to change.

Should work,
AJ
Jul 17 '09 #4
KingKen
68
Ok this solution did not work. I created the subform and linkes the fields but when i try to enter records it tells me that it cannot add values because it would create duplicate values in the index, primary key, or relationship.

Is there anyway that I could tweek this solution to allow the entry of many records by just changing the one record that needs adjusting
Jul 22 '09 #6

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

Similar topics

9
by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST ==...
5
by: Xiphias | last post by:
Hi, Can someone help me to create a drop box where I can also add new records? Here is the problem: I m working on a form with a drop box. When I select a '"name" in the drop box the form...
15
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
22
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4....
5
by: Bill | last post by:
This database has no forms. I am viewing an Access table in datasheet view. I'd like to execute a macro to execute a function (using "runcode"). In the function, I'll reading data from the record...
12
by: abetown3 | last post by:
Hello. I'm having data entry problems with a database I've created. I'm working in Access 2003 although the db was created in 2000 format. When data entry first began the db allowed for multiple...
25
by: tekctrl | last post by:
Anyone: I have a simple MSAccess DB which was created from an old ASCII flatfile. It works fine except for something that just started happening. I'll enter info in a record, save the record,...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.