Insert/select values from selection combo boxe

sahh1419

Registered User.
Local time
Today, 15:12
Joined
Dec 27, 2012
Messages
29
Dear all,
i want to insert obtain marks of the subjects.please find the attached my db for your kind review. when i select combo value my requirment is to insert the all records which associate with the combo. but when i select combo value it will happen nothing. pls see the required picture...also....
 

Attachments

  • db1.zip
    db1.zip
    50.7 KB · Views: 108
  • 123.JPG
    123.JPG
    42.9 KB · Views: 117
Please explain from where the different data/value should come:
Your query looks like below, (you are selecting data from the same query from which you want to insert them):
Code:
INSERT INTO Test1 ( Omarks, Percet, Remarks, [GR No], class )
SELECT Test1.Omarks, Test1.Percet, Test1.Remarks, Student.[GR No], Student.Class
FROM Test1, Student;
 
i have made some changes and nearly get the required result. but one problem in the query below. when i selected class it will insert marks and subjects in other classes also.please advised how i can restrict this...
-----------------------------------------------------------------------INSERT INTO Result ( [GR No], Tid, Tdate, Subject, Tm, class, nam, mob )
SELECT Student.[GR No], Test.tid, Test.tdate, Test.subject, Test.tmarks, student.class, student.name, student.mobile
FROM Student, Test
WHERE STUDENT.class=test.class And student.status='Active' And test.tid=tid
ORDER BY student.[gr no];
-----------------------------------------------------------------------
in one class it will insert only its subject marks. when i changed the class it will insert subject and marks in new class as well as in previouse class also.pls check the attached db..
 

Attachments

Sorry but I still can't find out what result you want to get.
Can you explain it, by the data you've in the attached database, what you get and the result you want to get. Take some print screen.
 
please see the attached file....
1.jpg
it contains the exact data with one class.
1a.jpg
it contains the other class data.
2.jpg (Wrong one)
when i change the class it will insert record in new class as well as in the previous class also.how i can insert this happening...
pls advised.
 

Attachments

  • 1.JPG
    1.JPG
    50.6 KB · Views: 111
  • 1a.JPG
    1a.JPG
    45.8 KB · Views: 105
  • 2.JPG
    2.JPG
    52.3 KB · Views: 108
When I open forms ("Test" and "Test query") in your attached database, they are empty, (no data, I don't know how to interact with them). See the attached picture.
The only tables with data are "Class" and "Student".
 

Attachments

  • Forms.jpg
    Forms.jpg
    86.7 KB · Views: 103
pls see the attached file...when i insert records in one class and after in the new calss the previouse class also duplicate record...
 

Attachments

Try by insert the following code in your Clas_AfterUpdate event instead of what you have, (sorry, else I give up, because I can't image what you are trying to do).

Code:
Private Sub Clas_AfterUpdate()
  On Error GoTo ErrorHandler
  Dim StrSQl As String, dbs As Database
  Dim stDocName As String
  Dim rs As Object
  
  DoCmd.SetWarnings False
  Set dbs = CurrentDb
  ' Find the record that matches the control.
  Set rs = Me.Recordset.Clone
  rs.FindFirst "[Class] = '" & Me![Clas] & "'"
  If Not rs.EOF Then Me.Bookmark = rs.Bookmark
  dbs.Execute ("Delete * FROM Result")
  stDocName = "Ases"
  DoCmd.OpenQuery stDocName, acNormal, acEdit
  DoCmd.GoToRecord , , acNewRec
ExitHandler:
  DoCmd.SetWarnings True
  Exit Sub
ErrorHandler:
  MsgBox Err.Number & Chr(13) & Err.Description
  Resume ExitHandler
End Sub
 

Users who are viewing this thread

Back
Top Bottom