Student management system debugging-real-time error ("424" "5" "91" real-time error ")

Source: Internet
Author: User

Recently I have just knocked on a small exercise applet, and some real-time errors have occurred. I plan to write a series of blog records when I think it may happen in the future, at the same time, let's talk and learn with everyone!

1. Real-time error "424" ---- required object

I personally think that this situation is entirely caused by unfamiliar beginners. The reason for this error is nothing more: the class name in the project is invalid (simply put, the form name or control name is written incorrectly );

This situation may not be useful for reference: http://blog.sina.com.cn/s/blog_4eb23c8d01011f82.html.

2. Real-time error "5" --- invalid process call or Parameter

Error code:

Private Sub Form_Load()  Text1.Text = ""  Text2.Text = ""  Text1.SetFocusEnd Sub

Cause:

The text1.setfocus attribute cannot be used during form_load (because the text box is not drawn during the loading of the form ).

Solution:

Set the tabindex attribute of the control text1 to 0.

3. Real-time error "91" --- the object variable or with block variable is not set


'Call the executesql function to execute the SQL statement to obtain the result set strsql = "select * From user_info where user_id = '" & txtusername. Text & "'" set objrs = executesql (strsql, strmsg)

There are two steps to create an object variable. First, object variables must be declared first. Then, you must use the set statement to assign a correct reference to the object variable. Similarly, the with... end with block must first use the with statement to enter the vertex for initialization.

This error is caused by the following reasons:

The object variable to be used has not been assigned a value by reference to a correct object.

Cause of my error: the password set in the module code is different from that set in the ODBC configuration process. As a result, the set statement cannot assign a correct reference to the object variable.

Solution:

Specify an object variable or specify another reference. For example, if the set statement is omitted in the following code, referencing myobject produces an error:

Dim myobject as object' creates an object variable. Set myobject = sheets (1) 'to create a correct object reference. Mycount = myobject. Count the Count value is assigned to mycount. The object variable to be used has been set to nothing. Set myobject = nothing to release this object. Mycount = myobject. Count 'References released objects.

Specify the referenced object variable. For example, use the new set statement to set a new reference for the object.
This object is correct but not set, because it is not selected in the "Reference" dialog box in the object library.
In the Add reference dialog box, select the object library.
The destination of the GOTO statement in the with block.
Do not jump into the with block. Make sure that the block uses the with statement to enter the vertex for initialization.

My solution: Modify the username and password in the module.

Public Function connectstring () as string '*************************************: set database connection string 'input parameter: none' return value: required database connection string connectstring' modification date: 2013.8.1 'Author: senior_lee '************************************** * *********** connectstring = "filedsn = student. DSN; uid = Lee; Pwd = 123 "End Function

Taking into account the length of the blog, I will make it easier today. It is a common mistake that I hope to help my readers. At the same time, I encountered some trouble while writing this blog. After debugging encountered an error, I only kept the error, no code is left, which makes it a great deal of trouble to write a blog summary. This is a warning for yourself and a reminder for everyone. Don't trust your memory too much!

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.