SalesLogix Function Issue

Question: Below is a function I have in SalesLogix and there seems to be a problem with my ‘End With’.  Suggestions?

Sub PopulateEmp(Sender)
Dim strQ
Dim strC
Dim oShell
Dim tUserID

Dim tAccountID
Dim tCreateUser
Dim tModifyUser

tUserID = application.basicfunctions.

CurrentUserID
tAccountID = frmAccountDetail.CurrentID
tCreateUser = application.basicfunctions.CurrentUserID

tModifyUser = application.basicfunctions.CurrentUserID

Set rs = CreateObject(“ADODB.Recordset”)
With rs
Set .ActiveConnection = Application.GetNewConnection
.CursorLocation = adUseClient

.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open “select * from EMPLOYEE where ACCOUNTID = ‘” & tAccountID & “‘”

If .RecordCount = 1 Then

tbxEmployeeTotal.Text = .Fields(“EMPLOYEETOTAL”).Value
Else IF .RecordCount = 0 Then
tbxEmployeeTotal.Text = “”
End If

.Close
End With

Set rs = Nothing

End Sub

 
Answer: Your problem is that in VBScript “Else If” need to be one word, “ElseIf”.  Change this:

If .RecordCount = 1 Then
tbxEmployeeTotal.Text = .Fields(“EMPLOYEETOTAL”).Value

Else IF .RecordCount = 0 Then
tbxEmployeeTotal.Text = “”
End If

to this:

If .RecordCount = 1 Then
tbxEmployeeTotal.Text = .Fields(“EMPLOYEETOTAL”).Value
ElseIf
.RecordCount = 0 Then

tbxEmployeeTotal.Text = “”
End If

 
 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!