Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default HELP PLEASE: getting multiple rows into access database in a new r

Hi All,

How can I make multiple data for the same column go in access.

eg: here is what My excel table looks like:

Student_ID Subjects Grades

123456 Eng A
123456 Hist B
123456 Math B+
123456 Bio B-

here is what I have in access for recordset:

With rs
.AddNew
.Fields("Student_ID") = Range("A3").Value
.Fields("Subject") = Range("B3").Value
.Fields("Grades") = Range("C3").Value

.Update
End With
r = r + 1

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default HELP PLEASE: getting multiple rows into access database in a new r

I presume you mean you are getting an error inserting rows into the table.
The field Student_ID cannot be set as the primary key if you want many rows
to contain the same ID. Remove the primary key. Also, if the field is
indexed select "Yes (Duplicates OK)"

A better way may be to have Student_ID as the primary key (only one row per
student) and have multiple fields for each subject, Math, Engrish, Spolling,
Gramor, etc (he he he). Then you only need to save the grade under each
subject field.

"sam" wrote:

Hi All,

How can I make multiple data for the same column go in access.

eg: here is what My excel table looks like:

Student_ID Subjects Grades

123456 Eng A
123456 Hist B
123456 Math B+
123456 Bio B-

here is what I have in access for recordset:

With rs
.AddNew
.Fields("Student_ID") = Range("A3").Value
.Fields("Subject") = Range("B3").Value
.Fields("Grades") = Range("C3").Value

.Update
End With
r = r + 1

Thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default HELP PLEASE: getting multiple rows into access database in a n

Oops.. Sorry I fogot to mention one thing.

There is a button "Submit" on the excel sheet that exports all of the
student data at once in the database.. and yea,, I DONT want the student ID
as the primary Key.. But I want to insert multiple student data in a seperate
row.. all at once..



"Charlie" wrote:

I presume you mean you are getting an error inserting rows into the table.
The field Student_ID cannot be set as the primary key if you want many rows
to contain the same ID. Remove the primary key. Also, if the field is
indexed select "Yes (Duplicates OK)"

A better way may be to have Student_ID as the primary key (only one row per
student) and have multiple fields for each subject, Math, Engrish, Spolling,
Gramor, etc (he he he). Then you only need to save the grade under each
subject field.

"sam" wrote:

Hi All,

How can I make multiple data for the same column go in access.

eg: here is what My excel table looks like:

Student_ID Subjects Grades

123456 Eng A
123456 Hist B
123456 Math B+
123456 Bio B-

here is what I have in access for recordset:

With rs
.AddNew
.Fields("Student_ID") = Range("A3").Value
.Fields("Subject") = Range("B3").Value
.Fields("Grades") = Range("C3").Value

.Update
End With
r = r + 1

Thanks in advance

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP PLEASE: getting multiple rows into access database in a new r sam Excel Programming 2 November 4th 09 06:25 PM
How to import multiple sheet of excel into Access database to a diffrent tables?? baka Excel Discussion (Misc queries) 0 July 6th 06 05:48 AM
copy multiple rows from a database bradasley Excel Programming 1 February 13th 06 04:10 PM
Importing from access database into multiple spreadsheets Sandy Excel Discussion (Misc queries) 1 September 8th 05 03:55 AM
Exporting data from ms-access database to multiple worksheets using ASP sridevi Excel Programming 0 May 11th 05 11:11 AM


All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"