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