Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, June 20, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an account
SLX_Novice
Posts: 246
 
Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an accountYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Oct 07 10:59 AM
Hi all, I have the following code in the Sub AXFormChange(Sender) in account detail view:

Dim es
Dim sqlstr

sqlstr = "select count(PM_CONTRACTSID) from PM_CONTRACTS where ACCOUNTID = '" & CurrentID & "'"
Set es = Application.GetNewConnection.Execute(sqlstr)
If Not es.EOF then

If es.Fields(0).Value > 0 then
Msgbox Application.Translator.Localize("This account has contracts, click on the Account Contracts Tab to view"), vbOKOnly, "SalesLogix"
else


End if
End If
es.Close
Set es = Nothing

End Sub

When I do a lookup for the account the msbox appears 2 or 3 times (I have to click OK 3 times for it to go away) or when I hit the Ctrl+F5 keys it does the same.

This doesn't happen if I have a large group and I simply scroll through the list.

Any idea how I can have it appear only 1 time after the user clicks OK?

Thank you in advance
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an accountYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Oct 07 4:15 PM
I'm sure it would help the guys here if you mentioned the version of SLX you are referring to. Behaviour like this can vary between versions.

You need to examine your code closely and try to work out why the AXFormChange event is being fired multiple times. This may come down to step-by-step debugging.

There's a lot of code in this form and that may take you some time. An alternative may be to display a label on the form in bold red letters - visible only when your condition is satisfied? Then it doesn't matter so much that the event fires more than once.

PP
[Reply][Quote]
SLX_Novice
Posts: 246
 
Re: Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an accountYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Oct 07 4:18 PM
You're right I forgot to mention the version: 6.2.6, I already have to red labels that appear, but they wanted this one to be a msgbox:

Sub AXFormChange(Sender)
Dim strAddress, strAddressDesc
Dim intIndex

On Error Resume Next

gStrCrntAddressID = txtAddressID.Text
Set objSLXDB = New SLX_DB
Set objBASIC = Application.BASICFunctions

mnuAddress.Items.Clear
lueParent.LookupRestrictValue = txtAccountID.Text 'Don't allow the current account to be its own parent

'Display the Primary address
If txtAccountID.Text = Sender.CurrentID Then
GetDisplayAddress False, "ACCOUNT", "ACCOUNTID", txtAddressID.Text, strAddress, strAddressDesc 'DNL
mmoAddress.Text = "" & strAddress
lblCurrentAddress.Caption = "" & strAddressDesc
Else
mmoAddress.Text = ""
MsgBox Application.Translator.Localize("You do not have access to this Account."),,"SalesLogix"
End If



Application.GlobalInfo.Add "CurrentEntityID", txtAccountID.Text 'DNL
ErrorCheck Application.Translator.Localize("Error updating global variable:")

If lueParent.LookupID <> "" Then
lueParent.Text = GetField("ACCOUNT", "ACCOUNT", "ACCOUNTID = '" & lueParent.LookupID & "'") 'DNL
ErrorCheck Application.Translator.Localize("Error retrieving Parent account information:")
Else
lueParent.Text = ""
ErrorCheck Application.Translator.Localize("Error clearing Parent account information:")
End If

If (lueParent.LookupID = "") And (GetField("COUNT(*)", "ACCOUNTSUMMARY", "PARENTID = '" & txtAccountID.Text & "'") = 0) Then 'DNL
cmdHierarchy.Enabled = False
Else
cmdHierarchy.Enabled = True
End If

gStrAccount = txtAccount.Text
On Error Goto 0

'-------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------Notifies user if the account has contracts in the Account Contracts Tab -FG 10/30/2007----------------

Dim es
Dim sqlstr

sqlstr = "select count(PM_CONTRACTSID) from PM_CONTRACTS where ACCOUNTID = '" & CurrentID & "'"
Set es = Application.GetNewConnection.Execute(sqlstr)
If Not es.EOF then

If es.Fields(0).Value > 0 then
Msgbox Application.Translator.Localize("This account has contracts, click on the Account Contracts tab to view"), vbOKOnly + vbExclamation, "SalesLogix"
else


End if
End If
es.Close
Set es = Nothing


'------------------------------------------------------------------------------------------------------------------------------------------
'-----------------------------------------------------------------------------------------------------------------------------------------

'-----------------------------------------------------------------------------------------------------------------------------------------
'------------------------Check for multiple addresses-------------------------------------------------------------------------------------

Dim rs
Dim sql
sql = "select count(addressid) from address where entityid = '" & CurrentID & "'"
Set rs = Application.GetNewConnection.Execute(sql)
If Not rs.EOF then

If rs.Fields(0).Value < 2 then
lblAddressCount.Caption = ""
else
lblAddressCount.Caption = "This account has multiple addresses"
'lblAddressCount.Caption = rs.Fields(0).Value & " addresses"
End if
End If
rs.Close
Set rs = Nothing

'-----------------------------------------------------------------------------------------------------------------------------------------
'------------------------Check for To and From Associations -----------------------------------------------------------------------------------

Dim ds
Dim sqlstring

sqlstring = "select count(associationid) from association where fromid = '" & CurrentID & "' or toid = '" & CurrentID & "'"
Set ds = Application.GetNewConnection.Execute(sqlstring)
If Not ds.EOF then

If ds.Fields(0).Value > 0 then
lblAssociation.Caption = "This account has Association(s)"
else
lblAssociation.Caption = ""

End if
End If
ds.Close
Set ds = Nothing

End Sub
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an accountYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 31 Oct 07 4:04 AM
It's a known issue (multiple events firing on FormChange). No easy way around it.
[Reply][Quote]
SLX_Novice
Posts: 246
 
Re: Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an accountYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 31 Oct 07 7:54 AM
Thanks Mike!
[Reply][Quote]
Sokha S.
Posts: 19
 
Re: Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an accountYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 31 Oct 07 3:51 PM
I ran into this problem also. It seems that the Saleslogix Lookup control will Clear the current value in the lookup, then change it to the new value. Hence the multiple firing of the when change event. One for the clear and one for the new value. Notice that it does not happen when the value is initially blank. Be careful with this event. Your code will be performed twice. Try using the whenPopUpReturn event or a series of flags so that the second time will ignore the code.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/20/2025 7:03:17 PM