11/26/2024 8:21:51 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.
|
|
|
|
Appending lines to datagrid.recordset
Posted: 10 Nov 06 8:52 AM
|
fiogf49gjkf0d I have a treeview and a datagrid on a custom form, separated by Add and Remove buttons. This process seems to work well for us as I have designed several similar screens before and all work great. This form is different, however and that is where I am running into some issues.
This form is called from a pop-up menu option to activate this 'Active Role Wizard' form. The datagrid on the 'Active Role Wizard' form is populated when it opens to display the current active roles the contact currently has set up. The treeview is populated by all contact roles available to choose from. When the user selects the role on the treeview to 'Add' to the grid, I want this role to append to the current list of active roles. If the user selects remove from the datagrid, I want the role removed from the datagrid. I have tried setting grdActiveRoles.Recordset to a new recordset, changing the locktype, cursorlocation, cursortype accordingly and I continuously get messages that I cannot update the current recordset as it is not allowed.
The other key to this form is that the changes will not be written to the database until the user selects OK. At that time if there were roles removed, they would be deleted from the database. New roles would then be added into the database appropriately. I am sure this is all possible, I just cannot seem to get my recordset to allow me to do updates.
The code below is the sub-routine called by the 'Add>' button on the form. (I am using 6.2.1) When I uncomment the 'with rsRoles' code, I was able to get the values in the datagrid to change, but it would just overwrite the existing value. There would only always be one value (the last value selected from the treeview) that would be listed in the datagrid.
Thanks, in advance, for any assistance!
Sub GetSelectedRole Dim strRoleIDs dim rsGridRoles, objRS dim objSLXDB
strRoleIDs = treContRoles.Selected.Tag set rsGridRoles = grdActiveRoles.Recordset
' msgbox rsgridroles.recordcount 'I receive the correct number of records currently in the datagrid
' set objSLXDB = new SLX_DB ' set rsRoles = objSLXDB.GetNewRecordset
' with rsRoles ' .fields.append "C_ContactID", adVarChar, 12 ' .fields.append "Contact_Role", adVarChar, 300 ' .Open ' end with
' strRoleIDs = treContRoles.Selected.Tag
if not trim(strRoleIDs) = Empty then with rsGridRoles If not (.BOF and .EOF) then .MoveLast end if .addnew .fields("C_ContactID").value = trim(strRoleIDs) .fields("Contact_Role").value = getdatavalue("Text","PickList","ItemID = '" & trim(strRoleIDs) & "'") .MoveNext end with rsgirdRoles.sort = "Contact_Role ASC" set rsgridRoles = rsgridRoles set grdActiveRoles.Recordset = rsgridRoles grdActiveRoles.Refresh end if End Sub |
|
|
|
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!
|
|
|
|
|
|
|
|