Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2007
    Location
    Sacramento
    Posts
    1

    Inserting multiple records into a table

    Hello every one. I'm stuck please help. I just started working with VBA.

    Heres my scenario. I have 2 tables: tblBox(BoxNumber) and tblFiles(FileNumber) with 1:M rel'ship.
    I'm using a form for user input containing a drop down list cboBoxNumber, a save button, and 2 text boxes txtFileNumberStart and txtFileNumberEnd. Currently when users physically box files, they would number the box and write down the file numbers inside the box. The file numbers are in numerical order starting from 1. I'm trying to emulate this process.

    On the form, users would select the box number from the drop down and type the range of files numbers using txtFileNumberStart and txtFileNumberEnd. This is better than having user type 1,2.3 and so on. I realize that I need to do a loop but I'm not having luck with my loop. It is not inserting any values to the table. For simplicity, I removed the dropdown, I just want the range of file numbers to work at this point.

    Dim LintCount as Integer
    Dim Counter as Integer

    LintCount = Me.txtFileNumberEnd .Value - Me.txtFileNumberStart.Value

    Counter = 1



    Do While Counter <= LintCount
    RunSQL = "INSERT INTO tblFiles(FileNumber) VALUES(Counter)"
    Counter = Counter + 1
    Loop

    Any help is much appreciated. Thanks!

  2. #2
    zaza123 is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    19
    Hmmph If u want it to imput to a table , u have to bound ur form to a table and bound all ur textbox to the field of the table. For the other part im quite unsure what u are saying can u simplify it for me

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Search for multiple records
    By Blake in forum Queries
    Replies: 1
    Last Post: 08-23-2013, 03:17 AM
  2. multiple fields in separate records
    By Fredo0709 in forum Database Design
    Replies: 9
    Last Post: 04-09-2010, 12:23 PM
  3. Saving records in multiple sub forms
    By niak32 in forum Forms
    Replies: 0
    Last Post: 10-13-2008, 04:24 AM
  4. Linking Multiple records
    By rricci@marcct.org in forum Programming
    Replies: 0
    Last Post: 02-14-2008, 09:18 AM
  5. How do I choose multiple records for a report
    By admaldo in forum Reports
    Replies: 2
    Last Post: 03-03-2006, 06:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums