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
Neil WylieNeil Wylie 

Login

    I have written an app. in VB6 with a form!load eevnt that logs into SalesForce using my account and password. This is now failing, and my internet connection is fine. Any ideas why?

Thanks
foghornfoghorn
Are there any error messages etc?
Neil WylieNeil Wylie
None. I have attached the code I'm using:
Under form ! Load:

'Log into SalesForce
If SampleLogin(Me.txtSF_User, Me.txtSF_Password) = True Then
    MsgBox "Logged in", vbOKOnly, "SalesForce"
    'CreateAccount
Else
    MsgBox "Login Failed"
    Exit Sub
End If

The function SampleLogin looks like:
Public Function SampleLogin(Username, Password) As Boolean
Set g_SFApi = New SForceOfficeToolkitLib3.SForceSession3
SampleLogin = g_SFApi.Login("wylneil@ntlworld.com", "letmein1CkCr5V5faCYYJFnERv9eVeJoi")
End Function

The password element fater letmein1 was supplied by SF to sageguard against hackers.
foghornfoghorn
Check ErrorMessage on the session (g_SFApi) when login fails.
 
g_SFApi.ErrorMessage
Neil WylieNeil Wylie
Sorry, I don't understand. how do I do this.
foghornfoghorn

if (! g_SFApi.Login("wylneil@ntlworld.com", "letmein1CkCr5V5faCYYJFnERv9eVeJoi"))

 

' failure message, should tell you why login failed

 MsgBox g_SFApi.ErrorMessage

Neil WylieNeil Wylie
Unable to send request to server.
A connection with the server could not be established.

Interestingly, when I went looking for the error collection, when I typed "g_Sfapi.", no predictive text came up.
foghornfoghorn
Humm, can you login from your test machine using a browser?
 
Also, what is the server url you are using?
 
MsgBox g_Sfapi.ServerUrl
Neil WylieNeil Wylie
Yes, I can log in on a browser:
username = "wylneil@ntlworld.com"
password = "letmein1"

Ok, I've just done it again.

I have created a new form, with 1 command button.
Under general declarations, i have:
Dim WithEvents g_SFApi As SForceOfficeToolkitLib3.SForceSession3

On the form!load event I have entered:
MsgBox g_SFApi.ServerUrl

Error message = Object variable or with block variable not set

This time I am getting predictive text.
Neil WylieNeil Wylie
Hi Foghorn,

sorry I have to sign off now - I have a bridge match in half an hour. Speak tomorrow.
Neil WylieNeil Wylie
Hi Foghorn,

That's me back on line. Did you have any success with my login problem.

Neil