8/23/2025 6:28:12 AM
|
|
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.
|
|
|
|
Pass data from Treeview to Grid
Posted: 24 Mar 08 1:22 PM
|
I am trying to pass data a user selects in a treeview to a datagrid that displays to the right of the treeview. Everything is populating correctly in the treeview, the problem occurs when I try passing the data to the grid. I am recieving an Object required error message. I do not want the values that are being passed to the grid to be updated. This is the second screen they see in a tabview, all changes to the database will be made on the last tab where they are required to validate all of the information they have entered. This is one flavor of code I have been trying when I receive the Object required error:
Sub GetSelectedFee Dim strFeeIDs Dim strRelCourseIDs dim rsSelectedFees
Set rsSelectedFees = CreateObject("ADODB.Recordset") Set rsSelectedFees.ActiveConnection = Application.GetNewConnection
If ErrorCheck("Error getting new connection.") Then Exit Sub rsSelectedFees.CursorLocation = adUseClient rsSelectedFees.LockType = adLockReadOnly rsSelectedFees.CursorType = adOpenForwardOnly
strRelCourseIDs = treFees.Selected.Tag
if not trim(strRelCourseIDs) = Empty then With grdSelectedFees.Recordset .Addnew .fields("tr_course_feeid").value = getdatavalue("TR_Course_FeeId", "TR_Course_Fee", "TR_CourseId = '" & trim(strRelCourseIDs) & "'") .fields("tr_courseid").value = trim(strRelCourseIDs) .fields("Description").value = getdatavalue("Description", "TR_Course_Fee", "TR_CourseId = '" & trim(strRelCourseIDs) & "'") .fields("fee_type").Value = getdatavalue("Fee_Type", "TR_Course_Fee", "TR_CourseId = '" & trim(strRelCourseIDs) & "'") .fields("amount").Value = getdatavalue("Amount", "TR_Course_Fee", "TR_CourseId = '" & trim(strRelCourseIDs) & "'") .Fields("CreateDate").Value = Application.BasicFunctions.TzLocalToGMT(Now,0) .Fields("ModifyDate").Value = Application.BasicFunctions.TzLocalToGMT(Now,0) End With set grdSelectedFees.Recordset = grdSelectedFees.Recordset grdSelectedFees.Refresh End If End Sub
Sub RemoveSelectedRole Dim strSelRole Dim rsRoles Dim strRole
strSelRole = trim(grdActiveRoles.GetCurrentField("C_ContactID")) strRole = grdActiveRoles.GetCurrentField("Contact_Role")
set rsRoles = grdActiveRoles.Recordset
if not trim(strSelRole) = Empty then With rsRoles .activeconnection = nothing .Filter = " C_ContactID = '" & strSelRole & "'" .delete .Filter = adFilterNone end with set grdActiveRoles.recordset = rsRoles grdActiveRoles.Refresh end if
set rsroles = nothing
End Sub
Thanks |
|
|
|
Re: Pass data from Treeview to Grid
Posted: 25 Mar 08 5:18 PM
|
Perhaps it's the line .activeconnection = nothing, when it should be set ... = nothing? I'm only guessing.
What you could do is use the standard error handling code copied from a SalesLogix plugin, include the SLX Error and then litter ErrorCheck("Performing x...") in your code as many times as necessary but name them all something unique. Then when the error trips you'll know roughly where in the code you need to look, usually the lines between the last error that didn't fire and the one that did. For any large routine I have I usually like to call ErrorCheck more than once to help narrow things down. Otherwise going through a multi-hundred line function looking for a slight miscalculation is extremely difficult. |
|
|
|
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!
|
|
|
|
|
|
|
|