Home > Software engineering >  Rookie a type mismatch is not passed, please help! Some machines, some not.. speechless
Rookie a type mismatch is not passed, please help! Some machines, some not.. speechless

Time:11-01

See guo-rong wang VB database design, sample have a not the past, is not in my book, in exchange for his desktop is OK,,,, to solve the
Private Sub Command2_Click ()
List1. Clear
'search (volume) all fields more than 10000 shares, using FindLast and FindPrevious
The criteria="volume & gt; 10000
"Ret=FindLast (Adodc1. You, the criteria) '& lt; -- -- -- -- -- -- -- -- -- -- -- -- -- in this tip type does not match the
While ret
List1. AddItem Adodc1. You (the name of "stock") & amp; "=" & amp; _
Adodc1. You (" volume ")
Ret=FindPrevious (Adodc1. You, the criteria)
Wend
End Sub

Private Sub Form_Load ()
Adodc1. The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 3.51; Data Source="& amp; App. The Path & amp; "\ \ stock01 MDB. Persist Security Info=False "
Adodc1.Com mandType=adCmdTable
Adodc1. RecordSource="stock list"
Adodc1. Refresh
The Set DataGrid1. The DataSource=Adodc1

End Sub

'the Find. Bas
'since the last record up search
The Function FindLast (rs As ADODB library. You, ByVal criteria As String)
On the Error Resume Next
Rs. MoveLast
Rs. Find the criteria, and adSearchBackward
FindLast=Not rs. BOF And Err. Number=0
End the Function

CodePudding user response:

You don't have a defined variable type, the system will default to variant
dim criteria as string
The criteria="volume & gt; 10000"

CodePudding user response:

reference 1st floor SupermanKing response:
you don't have a defined variable type, the system will default to variant
dim criteria as string
The criteria="volume & gt; 10000 "

You said I tried is not the problem or not on the two machines have different performance I suspect because of a problem for my desktop is DLL plug-in installed version of the ghost is the edition
Which big fairy have other Suggestions!

CodePudding user response:

The installer you do? Otherwise compatibility will be very bad,

CodePudding user response:

Dim ret As Boolean

The Function FindLast (rs As ADODB library. You, ByVal criteria As String) As Boolean
On the Error Resume Next
Rs. MoveLast
Rs. Find the criteria, and adSearchBackward
FindLast=Not rs. BOF And Err. Number=0
End the Function

CodePudding user response:

Handsome boy,, BCCN that I asked ok! Don't stick

CodePudding user response:

Program error when interrupts in the immediate window output this several variable types,
? Typename (ret); Typename (Adodc1. You); TypeName (criteria)
So you know which the type of the variable is out of question
  • Related