LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default Populate Excel FORM from Access - Pull from multiple rows

Hey Rick,

Did you get a chance to look into it.

I got something similar to what I want, I got to make it to work such that
It populates a listbox with the Students Grades But not able to get what I
really want.

Here is the piece of code that populates the listbox with students grades

Dim strSQL As String, conn As Object, rst As Object, k As Long, vaData As
Variant

Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & _
"Data Source=C\Documents\Students\Students_Data.accdb;"

strSQL = "SELECT Students_Grades" & _
" FROM Students_Info WHERE Student_ID = " & _
Me.StudentId.Value


Set rst = conn.Execute(strSQL)

With rst
Set .ActiveConnection = Nothing
k = .Fields.Count
vaData = .GetRows
End With

conn.Close

With UserForm1
With .listBox1
.Clear
.BoundColumn = k
.List = Application.Transpose(vaData)
.ListIndex = -1
End With
End With

Hope this helps

Thanks in advance

"Rick Rothstein" wrote:

Two questions...

1) Is your data always going to be sorted by the Student ID?

2) What are the names and locations with respect to each other (top left,
middle middle, etc.) for your controls?

--
Rick (MVP - Excel)


"sam" wrote in message
...
Hi All,

I know how to pull data from access and populate fields in excel userform
when I have only one row to pull from for a particualar Student_Id, BUT I
am
having issues
with pulling data from multiple rows for the same student( if the student
has multiple courses, it is displayed in multiple rows in a table) and
displaying them on the form once I input student ID.

For eg: I have a table "Student_Details" in access

Student_Details consists of Student_ID, Course, Grade, Quarter_ID

Student_ID Course Grade Quarter_ID
JP11456 Math A SP01
JP11456 Phy B SP01
MN3443 Bio B SP01
MN3443 Math A SP01
MM4456 Chem A SP01
MM4456 Math B SP01

So Basically, Once I Input Student_ID as "JP11456" in the student_ID field
in the excel Form, I want all the student data to be displayed in the form
in
their respective text boxes, something like this:

Student ID: JP11456

Course Grade Quarter_ID
Math A SP01
Phy B SP01
NA NA NA

I have created upto 3 textboxes for each field "Course", "Grade",
"Quarter_ID" as any student can take a maximum on only 3 courses per
quarter.

Hope I made it clear,

Thanks in advance



.

 
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: populate form fields from multiple access tables sam Excel Programming 3 February 2nd 10 05:41 PM
HELP PLEASE: populate form fields from multiple access tables sam Excel Programming 0 February 1st 10 08:51 PM
HELP PLEASE: Populate multiple excel rows in access at the same ti sam Excel Programming 2 November 4th 09 10:04 PM
auto populate access database from an excel form sam Excel Programming 1 July 1st 09 09:09 PM
When I select a specific .XLT I want it to populate w/Access Form VBAstudent Excel Programming 1 May 22nd 07 03:51 AM


All times are GMT +1. The time now is 01:50 AM.

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

About Us

"It's about Microsoft Excel"