Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 02-18-2007, 09:46 PM
Novice
 
Join Date: Feb 2007
Location: Sacramento
Posts: 1
New2Access
Default 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!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple fields in separate records Fredo0709 Database Design 9 04-09-2010 10:23 AM
Saving records in multiple sub forms niak32 Forms 0 10-13-2008 02:24 AM
Linking Multiple records rricci@marcct.org Programming 0 02-14-2008 06:18 AM
Search for multiple records Blake Queries 0 10-30-2006 12:04 PM
How do I choose multiple records for a report admaldo Reports 2 03-03-2006 03:02 AM


All times are GMT -8. The time now is 02:43 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.