6/20/2025 10:31:29 PM
|
|
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!
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.
|
|
|
|
Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an account
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 |
|
|
|
Re: Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an account
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 |
|
|
|
Re: Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an account
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 |
|
|
| |
| |
|
Re: Msbox appears 3 times when pressing Ctrl+F5 or after a lookup of an account
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. |
|
|
|
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!
|
|
|
|
|
|
|
|