Hi everyone.. I desperately need some help... I have a database with the following tables. SUDENT TABLE, COURSE TABLE, SUBJECT TABLE AND RESULT TABLE. My problem is how doI insert the SUBJECT_ID INTO RESULT TABLE SUBJECT_ID in sequential order
STUDENTID(NRIC) CLASS_ID SUBJECT ID RESULT ID MARKS
------------ ----------- ----------- ----------- -------
S1 | 106A | A | 1 | 50
S1 | 106A | B | 2 | 60
S1 | 106A | C | 3 | 70
S1 | 106A | D | 4 | 50
S2 | 106A | A | 5 | 40
S2 | 106A | B | 6 | 50
S2 | 106A | C | 7 | 70
S2 | 106A | D | 8 | 80
Below is my coding
strSQL = "SELECT * FROM SUBJECT WHERE train_Class = '" & Text1 & "'"
strSQL2 = "SELECT * FROM RESULT"
strSQL3 = "SELECT * FROM [Trainee DataBase] WHERE COURSEID= '" & Text1 & "'"
Set db = CurrentDb()
Set rst = db.OpenRecordset(strSQL)
Set rst2 = db.OpenRecordset(strSQL2)
Set rst3 = db.OpenRecordset(strSQL3)
Do While Not rst3.EOF
For I = 1 To rst.Fields.Count
rst2.Fields("NRIC").Value = rst3.Fields("NRIC NO").Value
rst2.Fields("CLASS_ID").Value = Text1.Value
Do While Not rst.EOF
For J = 1 To rst.Fields.Count
In your SQL statement, include "ORDER BY YourField"
strSQL = "SELECT * FROM SUBJECT WHERE train_Class = '" & Text1 & "' ORDER BY SUBJECT_ID"
You basic SQL format is:
SELECT something FROM somewhere WHERE conditions ORDER BY criteria
A bit of advice: never use spaces in the names of objects. Although Access let's you get away with it, it complicates your code and will present problems when you build something that may be upsized to MSSQL or others later in life.
Can someone Pls help me.. I have attached the file. I'm having this error called "no current record" 3021.
I need to addnew records in result table by one click on the button.
Let say if the class have 3 student. This class student have three subjects.
This three subject will be key in only onces and the rest will be inserted into result table. Please advice. Thanks and appreciated