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 as a form_load event

Hi all,
 
I am working in VB6 and am trying to create a form_load event that will log me onto Sales Force. Is there any example code around? I have tried the code supplied in the handbook, but that fails.
 
Neil
Vishal PandeyVishal Pandey

Private Sub Form_Load()


If SampleLogin("Me.txtUserName", "Me.txtPassword") = True Then
    MsgBox "Logged in", vbOKOnly, "SalesForce"
   

    'CreateAccount
Else
    MsgBox "Login Failed"
    Exit Sub
End If

 

End Sub

Public Function SampleLogin(Username, Password) As Boolean
Set g_SFApi = New SForceOfficeToolkitLib3.SForceSession3
SampleLogin = g_SFApi.Login("username", "passwordwithsecuriytoken")

MsgBox g_SFApi.ErrorMessage

End Function

Neil WylieNeil Wylie
Thnaks for that. I've got it running.