Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 828
  • Last Modified:

"Error 3001: Arguments are of wrong type..."

"Error 3001: Arguments are of wrong type..." while writing to stream

My application is in VB6 and my database in Access 2000

I use the ADODC to connect to the dabase. What I want to do is a simple search in the recordset and navigate to the appropriate record if found. I use the following syntax:

  adodc1.movefirst
  adodc1.find "FOLDER=" & iFolder & " AND MAJOR=" & iMajor

where FOLDER and MAJOR are the fields i want to do the search and are both INTEGER NUMBERS. Also iFolder amd iMajor are INTEGER variables which get their values from two textboxes.

The error I get is

"Error 3001: Arguments are of wrong type..."

Te strange thing is that if I use only one of the variables the thing seems to be working fine.

Any ideas please?
 
 
0
starman75
Asked:
starman75
  • 3
1 Solution
 
wsteegmansCommented:
Try this ...

Because the variables iFolder and iMajor are INTEGER variables, you must typecast them to strings (because you are concatinating a Find-String)

I should also explicit use the RecordSet property. So try this code ...

  adodc1.Recordset.Movefirst
  adodc1.Recordset.Find "FOLDER=" & CStr(iFolder) & " AND MAJOR=" & CStr(iMajor)
0
 
SNilssonCommented:

Only a single-column name may be specified in criteria. This method does not support multi-column searches.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdamth02_6.asp
0
 
SNilssonCommented:
0
 
D_M_DCommented:
Try this...

adodc1.movefirst
 adodc1.find "FOLDER='" & iFolder & "' AND MAJOR='" & iMajor & "'"


--------
D_M_D
0
 
SNilssonCommented:
Well I do care since I'm positive that my first answer is the correct one.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now