[Student] a small bug

In the process of optimizing my students, I found myself logic is confusing, hard to sort out what I think I should be the link between the various forms of the students, but jumped out of the question, this is my Best not its solution ah! Until, I called my little partner - small beans collapse, he is a very clear idea of ​​the people, he was beside me guidance, I finally solved the problem.

What exactly happened?

This form is to add the results, I had the code to achieve the function when selecting the class number, the corresponding student number, course name and the corresponding will appear , but this morning I do not know why are not point out.

 I thought it was code, the SQL statement is not wrong, tinker morning, I put the code with source code control one by one, but that did not find any problems, I would like to have brain Jen have blown up, oh, pain! (O ¨Ò ¨Ò) (¨Ò ¨Ò o) (o ¨Ò ¨Ò)

Then, after the collapse of small beans pulled over, he helped me analyze a bit, because I had no reason clear links between the various forms, add student information form, add class information form, add performance information form these three form, this number has class properties, and class number as a foreign key, and the main code in connection with these three forms, (class number in the non-primary attributes add student information and performance information to add, in add class information is the primary key), so the number of class unity is essential, but not the source code form of these three closely related, but each of the tubes, each with a textbox control to the form enter the class number, which can, provided that we ensure that in each form class number entered is the same, otherwise, in a diagram, the can not be achieved choose the class number, the corresponding student number, course name and city the corresponding emergence of function.

Gosh, write so many, I do not want to see, however, no way ah ......

This is a record number of students in this class table

This is the class of this class number in the table

 This is the class number is recorded in the results table

So, the little collapse beans that you use combobox number three classes are unified, each time only to read the data class number of students, not on the line.

Really awoken it,

So, I added some code like this results in a form, you can run both unified

Dim mrc As ADODB.Recordset
    Dim txtsql As String
    Dim msgtext As String

    flagselect = False
                                                                '添加班号到ComboBox
    txtsql = "select * from class_Info "
    Set mrc = ExecuteSQL(txtsql, msgtext)

    While (mrc.EOF = False)
        comboclassno.AddItem mrc!class_No
        mrc.MoveNext
    Wend
    mrc.Close

 

发布了28 篇原创文章 · 获赞 1 · 访问量 1658

Guess you like

Origin blog.csdn.net/weixin_43729166/article/details/100628985