Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Typical VB constant error 1

Status
Not open for further replies.

meldrape

Programmer
Joined
May 12, 2001
Messages
516
Location
US
Greetings, once again, forgive me if this has been answered but the search feature is not available. I have a standalone vbs script to acquire remote computer info. It uses an access database but I want to use a SQL2000 database so I changed the connection string to reflect this. Now I'm getting the famous "arguments are of the wrong type" error so I copied and pasted the entire adovbs.inc file into the script but still get the error. Any helpful thoughts would be appreciated. My add record code is as follows:
Code:
Set objRS = CreateObject("ADODB.Recordset")
objRS.CursorType = ? do I need this
objRS.LockType = ? do I need this
objRS.Source = "Computerinfo"
objRS.ActiveConnection = objCon
objRS.Open
objRS.AddNew
objRS("IPAddress")=strComputerName
objRS("ComputerName") = strName
objRS("Model") = strModel
objRS("Vendor") = strVendor
objRS("Serial") = strSerial
objRS("Version") = strVersion
objRS("CPU") = strCPU
objRS("Speed") = strSpeed
etc. etc.
objRS.Update
Any thoughts would be appreciated. Thanks.
 
Hello meldrape,

To accommodate .addnew and .update, you can set the cursortype opendynamic and locktype lockoptimistic.
[tt]
objRS.CursorType=2 'adOpenDynamic
objRS.LockType=3 'adLockOptimistic
[/tt]
regards - tsuji
 
Works great. Many thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top