Home > Software engineering >  Display type does not match, a great god, with all the code
Display type does not match, a great god, with all the code

Time:09-20

All the HTML code is as follows, open this window, click the run will display type do not match, the third paragraph beginning Sub InitLX () the yellow, the third section of the sixth row. AddItem blue

 Option Explicit 
Public sqlStr As String

Private Sub Form_Load ()
InitLX
End Sub

Sub InitLX ()
SqlStr="select Type from the Type order by Type", "
Adodc1. RecordSource sqlStr=
Adodc1. Refresh
While Not Adodc1. You. EOF
CboLX. AddItem Adodc1. You
Adodc1. You. MoveNext
Wend
End Sub


Private Sub cmdAdd_Click ()
Dim As Integer I
Dim MAX As Integer
Dim LXBH As Integer
For I=0 To 4
If txtHeritagei. Text="" Then
MsgBox ", please complete the information, "vbOKOnly + vbExclamation," warning "
The Exit Sub
End the If
Next I
SqlStr="select Type number from the Type where" _
& "[type]='" & amp; Trim (cboLX. Text) _
& "' AND" & amp; "[home]='" & amp; Trim (txtHeritage2. Text) _
& "' AND" & amp; "[on time]='" & amp; Trim (txtHeritage3. Text) & amp; "
"Adodc1. RecordSource sqlStr=
Adodc1. Refresh
EOF Then If Not Adodc1. You.
LXBH=Adodc1. You. Fields (" type code ")
The Else
MsgBox "found no type information, please add type information, and then add heritage information!" , vbOKOnly + vbExclamation, "warning"
The Exit Sub
End the If
SqlStr="select Max (legacy code) from the Heritage"
Adodc1. RecordSource sqlStr=
Adodc1. Refresh
MAX=Adodc1. Recordest. Fields (0)
'add a new record
SqlStr="select * from the Heritage"
Adodc1. RecordSource sqlStr=
Adodc1. Refresh
With Adodc1. You
The AddNew
Fields (" legacy code ")=MAX + 1
Fields (name of "heritage")=txtHeritage1. Text
Fields (" type code ")=LXBH
Fields (" site ")=txtHeritage2. Text
Fields (" on time ")=txtHeritage3. Text
Fields (" introduction ")=txtHeritage4. Text
. The Update
End With
MsgBox "heritage information added to complete!" , vbOKOnly + vbExclamation, "warning"
ClearTextBox
InitLX
End Sub

Sub clearTextBox ()
TxtHeritage1=""
TxtHeritage2=""
TxtHeritage3=""
TxtHeritage4=""
End Sub

Private Sub cmdCancel_Click ()
Unload Me
End Sub

CodePudding user response:

All commented On the Error Resume Next statement, in VB6 IDE,
The error and then click the debugging, the cursor will stop error in the statement,
Or
In doubt may have a logical error statements in advance to set breakpoints, run through the breakpoint interrupt,

At this point can be used in the immediate window
? The variable name
Or
? The function name () function parameter
Or
Process (parameters)
Auxiliary debugging,


TypeName function


Returns a String that provides information about the variable,

Syntax

TypeName (varname)

Necessary varname argument is a Variant, it contains the user defined type variable outside of any variable,

Description

TypeName the returned string can be any of the list below:

Returns a string variable
Object type type for the objecttype
Byte value
Integer to Integer
Long Long integer
Single Single precision floating point number
Double double-precision floating-point number
Currency monetary
A Decimal Decimal value
The Date Date
String String
Boolean Boolean
Error Error values
The Empty uninitialized
Null invalid data
Object
Unknown type Unknown object
Nothing is no longer the object of the reference object variable


If varname is an array, then the returned string can be any one behind add empty parentheses may return a string (or Variant), for example, if varname is an Integer array, TypeName returns "Integer ()",

CodePudding user response:

reference 1st floor zhao4zhong1 response:
comment out all On Error Resume Next statement, in VB6 IDE,
The error and then click the debugging, the cursor will stop error in the statement,
Or
In doubt may have a logical error statements in advance to set breakpoints, run through the breakpoint interrupt,

At this point can be used in the immediate window
? The variable name
Or
? The function name () function parameter
Or
Process (parameters)
Auxiliary debugging,


TypeName function


Returns a String that provides information about the variable,

Syntax

TypeName (varname)

Necessary varname argument is a Variant, it contains the user defined type variable outside of any variable,

Description

TypeName the returned string can be any of the list below:

Returns a string variable
Object type type for the objecttype
Byte value
Integer to Integer
Long Long integer
Single Single precision floating point number
Double double-precision floating-point number
Currency monetary
A Decimal Decimal value
The Date Date
String String
Boolean Boolean
Error Error values
The Empty uninitialized
Null invalid data
Object
Unknown type Unknown object
Nothing is no longer the object of the reference object variable


If varname is an array, then the returned string can be any one behind add empty parentheses may return a string (or Variant), for example, if varname is an Integer array, TypeName returns "Integer ()",


Thank you, before is my wrong array and modify the part of the code is as follows, after running according to
After a string of 1 quotation mark is not complete, the yellow line 16 Adodc1. Refresh, this is how to return a responsibility? Excuse me, thank you
 Private Sub cmdAdd_Click () 
Dim As Integer I
Dim MAX As Integer
Dim LXBH As Integer
For I=0 To 3
If txtHeritage (I). The Text="" Then
MsgBox ", please complete the information, "vbOKOnly + vbExclamation," warning "
The Exit Sub
End the If
Next I
SqlStr="select Type number from the Type where" _
& "[type]='" & amp; Trim (cboLX. Text) _
& "' AND" & amp; "[home]='" & amp; Trim (txtHeritage (1). The Text) _
& "' AND" & amp; "[on time]='" & amp; Trim (txtHeritage (2). The Text) & amp; "
"Adodc1. RecordSource sqlStr=
Adodc1. Refresh
EOF Then If Not Adodc1. You.
LXBH=Adodc1. You. Fields (" type code ")
The Else
MsgBox "found no type information, please add type information, and then add heritage information!" , vbOKOnly + vbExclamation, "warning"
The Exit Sub
End the If
SqlStr="select Max (legacy code) from the Heritage"
Adodc1. RecordSource sqlStr=
Adodc1. Refresh
MAX=Adodc1. You. Fields (0)
'add a new record
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related