function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to log in via VB6

I was told that when I signed up as a developer, I would have access to a demo database.

I was told that I would use my logon user name and password to logon to Sales Force.


I copied the VB code from the PDF and appears to work, but I am getting an error:


"Invalid username, password, security token; or user locked out."


I assume the User name and/or password is not the correct one to use.


I did use WireShark to confirm Internet traffic was occuring when trying to login.


Any help would be appreciated,


Best Answer chosen by Admin (Salesforce Developers) 
In the main salesforce app, under setup, under My Personal Information, under Reset My Security Token

All Answers

Check out the docs on api logins, pay special attention to login restrictions and api tokens...

Thanks for the info. I saw in the email that was sent to me when I signed up with: You'll receive a separate email with instructions on how to get started.


I have not received that email yet.


I did see where a security Token will be needed to be added to the password.


I guess the next question: How do I get the security token?

In the main salesforce app, under setup, under My Personal Information, under Reset My Security Token
This was selected as the best answer
Thank you, foghorn. It worked beautifully.

OK, I have login and I can list the "Fields". I take it these "Fields" are a default on creating the Database.


With an ODBC connection I can list all the Tables and Fields of any database, but I cant' find any good reference to how to do this here.


The one reference showed how to list "objects" (Tables?), but it used a reference to a class that does not exist in the DLL. One reply asked the poster where to get that reference, but no responce (2007).


The code in the PDF shows how to run a query:  Set qr = g_sfApi.Query("select * from task", False)


But when I run it, there is no return data. I assume the table "task" does not exist.

Also, the rest of the example does not show how to retrieve the data.

This straight from the PDF API file.



    Dim qr As QueryResultSet3
    Dim v As Variant
    Dim s As SObject3


    Set qr = g_sfApi.Query("select * from task", False) 


    For Each v In qr
        'loop through the results
        'cast to a sobject3 to see more helpful debug info
        Set s = v
        'use the object
        s( "Name" ) =  "Query"
    Next v




I've been writing in VB for over 10 years, but I have to admit, I don't get this.

Can someone help me understand how to list tables, fields, and run a query and see the results?

Message Edited by Ira on 01-18-2010 04:34 PM
Message Edited by Ira on 01-18-2010 04:35 PM
Message Edited by Ira on 01-18-2010 04:38 PM

The toolkit only has one "data" "sobject", it wraps all the standard and custom "tables" an org can have in sfdc.

The key here is looking at EntityType, it is a string, for example "Task".

This is known in sfdc as a "Partner wsdl" concept, as the schema is different for possibly every user session.

This is different from a standard schema notiion, where there is a set of well defined tables and columns.  In sfdc this is the concept of an "Enterprise" wsdl (see docs for more info on both).


The fields exposed by an instance of a sobject depend on the object type (task, account, etc) and the custimzations applied to the object (custom fields).


In your example, Task does exist, there are just no rows that match the query (if Task didn't exist you'd get an error).



Thank you again, foghorn. Your help is much appreciated.


So, what I know in my VB world as Tables are Objects in sfdc.


Although the example above does not show how to view the data of a query, I will endeavor to figure that out.


I hope you wont mind if I call upon you to assist if I can't ascertain how to do that.


Thanks again, Ira

Hi Ira, have . you ever resolved that?