Results 1 to 2 of 2
  1. #1
    Velz is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    1

    Need help with vba and a multivalue field

    So I have an access database with linked SharePoint tables. One of the columns in the table is multi-value. I'm using a recordset to create a new record and using another recordset to populate the multi-value field called "Team". However, when i run the code, I get a 3027 run-time error message ("Cannot update. Database or object is read-only"). Can someone help me out and let me know why I'm getting the error message? Here is the code:

    Code:
    Set db = CurrentDb()
    Set rs = db.OpenRecordset("MyTable")
    Set rsBT = db.OpenRecordset("SELECT Person1ID, Person2ID, Person3ID, Person4ID FROM [PeopleData] WHERE Person1ID =" & Me.PersonFormField, dbOpenDynaset)
    
    
        rs.AddNew    
            rs![Account] = Me.Account
            rs!Person1ID = Me.PersonFormField
            rs!Region = Me.Region
            rs!Request = Me.Request
            rs![Date In] = Now()
            rs!Notes = Me.Notes
       
            Set rsMV = rs.Fields("Team").Value
       
        
          For i = 0 To 3
                    If Not IsNull(rsBT.Fields(i)) Then
                        rsMV.AddNew
                            rsMV.Fields(0) = rsBT.Fields(i)
                        rsMV.Update   'error happens on this line
                    Else
                        Exit For
                    End If
                Next i
                
        rs.Update
    Thanks in advanced for the help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I can't see anything wrong with code. I always thought code was required to add data to MV field if not done by combo or list box data entry. This article says it can be done with query. https://support.office.com/en-us/art...n-US&ad=US#bm7

    Review another recent thread concerning the query method https://www.accessforums.net/queries...eld-49034.html

    However, if Access thinks the object is read-only, probably no method will work.

    I don't see rsMV variable declared.

    I've never used MV fields but also never built web database.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Default value for multivalue field
    By lonesoac0 in forum Access
    Replies: 9
    Last Post: 08-13-2019, 03:20 PM
  2. Multivalue Field Advice
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 04-30-2013, 07:40 PM
  3. Simulating a Multivalue Field
    By EddieN1 in forum Database Design
    Replies: 3
    Last Post: 12-12-2011, 10:57 AM
  4. Multivalue field sort order
    By bdaun in forum Forms
    Replies: 0
    Last Post: 09-05-2011, 12:27 PM
  5. Append into multivalue field help
    By iwantatransam in forum Import/Export Data
    Replies: 0
    Last Post: 04-26-2011, 08:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums