473,473 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MS Access SharePoint multi value list modification

maxamis4
295 Recognized Expert Contributor
So I am creating a UI for SharePoint via MS Access. Typically I advise my clients not to use multi value lists for junctions and it typically stays that way. However in this case the SharePoint UI will be used on some limited basis which requires the junction to be present and visible. Enter the multivalue list option.

I am have trouble with my multi-value delete query. With the multi value list I see that you have to treat the value list almost like an independent query. The problem is I have two criteria to filter by. The parent record and then the multi value ID. When executing the query i get an error that indicates I can not use the parent ID in a multi-value query. I tried to use a nexted select/delete statement with no luck. Went back to the basics and have been stock since.

Expand|Select|Wrap|Line Numbers
  1.  
  2. DELETE [Regional Application Mapping].[Production Servers].Value, [Regional Application Mapping].ID
  3. FROM [Regional Application Mapping]
  4. WHERE ((([Regional Application Mapping].[Production Servers].Value)=707) AND (([Regional Application Mapping].ID)=241));
  5.  
  6.  
Regional Application Mapping].ID)=241 'This is the parent record filter. I want to identify the App ID first to narrow my search on the value that I plan on deleting. mind you the servers value can be used with other parent records as an option. its technically a many to many relationship but 1 to 1 on the record level. This filter is the one that fails
Aug 30 '13 #1
6 4584
maxamis4
295 Recognized Expert Contributor
So I found a very ugly work around and I am building the function to do it but it is killing me to think that I have to write an entire module to perform this action. Anyone have any thoughts:

Work aournd
Expand|Select|Wrap|Line Numbers
  1. Function Delete_Multi_value_List(AppID, SrvID)
  2. 'MULTIVALUE LISTS http://stackoverflow.com/questions/6018172/update-a-multi-valued-field-in-access
  3.  
  4. 'READS ALL SHAREPOINT MULTIVALUE LISTS
  5.  
  6.    Dim db As Database
  7.    Dim rs As Recordset
  8.    Dim childRS As Recordset
  9.    Dim myInt As Integer
  10.    Dim myApp As String
  11.  
  12.  
  13.    Set db = CurrentDb()
  14.  
  15.    mySql = "SELECT [Regional Application Mapping].ID, [Regional Application Mapping].*, [Regional Application Mapping].ID FROM [Regional Application Mapping]" _
  16.                             & " WHERE ((([Regional Application Mapping].ID)=" & AppID & "));"
  17.  
  18.    ' Open a Recordset for the Tasks table.
  19.    Set rs = db.OpenRecordset(mySql)
  20.    rs.MoveFirst
  21.  
  22.    Do Until rs.EOF
  23.  
  24.       ' Open a Recordset for the multivalued field.
  25.       Set childRS = rs![Production Servers].Value 'Production Systems
  26.       'Set childRS = rs![Non-Production Servers].Value 'Non Production Systems
  27.  
  28.       myApp = rs![Application Name]
  29.       myInt = DLookup("[ID]", "Regional Application Mapping", "[Application Name] = '" & myApp & "'")
  30.  
  31.       If myInt = AppID Then
  32.          ' Exit the loop if the multivalued field contains no records.
  33.          Do Until childRS.EOF
  34.              childRS.MoveFirst
  35.  
  36.              ' Loop through the records in the child recordset.
  37.              Do Until childRS.EOF
  38.  
  39.                   If childRS!Value.Value = SrvID Then
  40.  
  41.                     childRS.Delete
  42.  
  43.                   End If
  44.  
  45.  
  46.                  childRS.MoveNext
  47.              Loop
  48.          Loop
  49.  
  50.       End If
  51.  
  52.       rs.MoveNext
  53.    Loop
  54. End Function
  55.  
  56. Still very sloppy but I will post the cleaned up version.  If anyone knows any other way let me know.
  57.  
  58.  
Aug 30 '13 #2
Rabbit
12,516 Recognized Expert Moderator MVP
I don't know much about Sharepoint but in the first post, if you're trying to delete the multi-value, then why do you have the parent id in the delete clause as well? I understand that it's in the where clause to filter it, but I don't understand why it would also be in the delete clause unless you meant to delete the parent record, in which case you wouldn't have the multi-value in there.
Aug 30 '13 #3
zmbd
5,501 Recognized Expert Moderator Expert
You might try replacing your multi-value field with a lookup control or base it on a table/query. This way you need only edit the underlying data table to the control.
MicroSoft - Guide to multivalued fields ACC2007
-- about midway (maybe less) down into this document may be helpful there, and then there's a link to modifying etc... I'm sure this also applies to/works with ACC2010.
Sep 2 '13 #4
maxamis4
295 Recognized Expert Contributor
Rabbit,

You need the parent ID to find the primary recordset. From there loop through the multivalue list and delete the records needed.

Example:
Honda, Accord, 2011 would be the parent recordset. The multivalue list would incorporate features like leather interior, GPS, turn sensors, backup camera, etc...

Now the real way to do it is as Zmbd suggested. The problem is my client still wants to keep the front end options in Sharepoint and without the multivalue option he can't select options that relate to another list.
Sep 2 '13 #5
Rabbit
12,516 Recognized Expert Moderator MVP
@maxamis, I understand you need the parent id to find the correct record, that's why you have the where clause. I don't understand why you would tell it to delete the parent record though in the delete clause.
Sep 2 '13 #6
zmbd
5,501 Recognized Expert Moderator Expert
maxamis4,
I know that this may sound stupid; however, I do have a good reason for asking: how was the multi-value field created to begin with?
Basically, what is the record source for the field?

[edit] How to: Manipulate Multivalued Fields With DAO - Office 2010 If you can open the multivalue as a record set, then you should be able to find, edit, or delete the value from the list like any other record set... I am grapsing at the straws here for you :)[/edit]
Sep 2 '13 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: MSD | last post by:
I am running a report that uses a query as its record source and opens a form collecting beginning and ending item numbers to feed to the query. This works, but now I'm trying to use the result of...
2
by: Neil Ginsberg | last post by:
I'm having a problem with a multi-select list box set to Simple multi-selection. If multiple items are selected and then I change the items in the list, the list positions previously selected are...
3
by: syounger | last post by:
Hi. I have a report in Access 2000 that is based on selection made from a series of interdependent list boxes. The boxes I have right now are Source, Table, Column, Date. The user chooses Source...
2
by: Zlatko Matić | last post by:
Hello. How to reference selected values from a multi-select list box, as a criteria in a query ? Is it possible at all? Regards, Zlatko
5
by: dkelly925 | last post by:
Is there a way to add an If Statement to the following code so if data in a field equals "x" it will launch one report and if it equals "y" it would open another report. Anyone know how to modify...
2
by: rich | last post by:
I am populating a list box from a dictionary table and then picking muliple values to insert into a detail table. How do I get the list box to have multiple selections highlighted when I pick one...
4
by: Fran | last post by:
I recently tried to use code for "Use a multi-select list box to filter a report" from Allen Browne in my database. I was able to add the code and adapt it to my needs, however I am getting an...
1
by: KrazyKasper | last post by:
Access 2003 – Multi-Column List Box – Select Multiple Items I have a multi-column (3 columns) list box that works well to select one set of records or all sets of records (based on the first field...
3
by: jim | last post by:
Each night, a scheduled task copies certain information from an MS Access db to a MySQL db that serves as a data warehouse. I would like to begin replicating multi-value fields from Access to...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.