Student Management System Issues highlights 1

Source: Internet
Author: User

Problem 1: When the database record is blank, an error is reported when the "Modify student status information" form is opened.
Solution:
Add the following code under the "Modify student status information" menu command of the main form frmmain

'Check whether the record set in the student_info table is empty.
'If it is blank, the "add student status information" form is opened.
'If it is not blank, the "Modify student status information" form is opened.
Private sub modifysinfomenu_click ()

'Define the database connection string
Dim strtxtsql as string
Dim strmsgtxt as string
'Create an object to check whether the student_info table record is empty
Dim rstobjcount as ADODB. recordset
'Create an object that records the return value of msgbox
Dim intmsg as integer

'Database connection statement
Strtxtsql = "select * From student_info"
'Get the record set of student_info and assign it to rstobjcount
Set rstobjcount = executesql (strtxtsql, strmsgtxt)

'Check whether the record in the student_info table is empty
If rstobjcount. recordcount = 0 then
Intmsg = msgbox ("the record set is empty, fill in now or not", vbokcancel, "warning ")

'If yes, the "add information" form is opened.
If intmsg = vbok then
Frmaddsinfo. Show
Exit sub
Else
Exit sub
End if

Else
Frmmodifysinfo. Show
End if

End sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.