[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

Access splitting issue: Operation is not supported for this type of object

The code below worked fine until I split the database with the Database Splitter.  Now I get error 3251: 'Operation is not supported for this type of object'.  Help!

Private Sub cmdOpenMailingForm_Click()

' Opens form so a new mailing for the selected organisation can be added

On Error GoTo Err_cmdOpenMailingForm_Click

    Dim stDocName As String
    Dim stLinkCriteria As String
    Dim intCancel As Integer
   
    ' Check an organisation is selected
    If (Me!lstOrganisations = "" Or IsNull(Me!lstOrganisations)) Then
        MsgBox "Please choose an organisation", vbExclamation + vbOKOnly, conProgname
        Exit Sub
    Else
        Dim db As Database
        Dim rec As Recordset
       
        Set db = CurrentDb()
        Set rec = db.OpenRecordset("tblOrganisation")
       
        rec.Index = "OrganisationID"
        rec.Seek "=", Me.lstOrganisations
       
        ' If organisation isn't active throw up a message
        If rec("Active") = "False" Then
            MsgBox "This organisation is inactive." & vbCrLf & _
                "If you want to send items to it please make it active again.", vbExclamation + vbOKOnly, conProgname
        Exit Sub
        Else
            stLinkCriteria = "[OrganisationID]=" & Me![lstOrganisations]
            DoCmd.OpenForm "frmMailing", , , stLinkCriteria, acFormAdd ' Opens the form to add a mailing
            Forms!frmMailing!OrganisationID = Me![lstOrganisations]
           
            Forms!frmMailing!txtOrganisation = rec("OrgName")
           
            Set db = Nothing
            Set rec = Nothing
        End If
     End If

Exit_cmdOpenMailingForm_Click:
    Exit Sub

Err_cmdOpenMailingForm_Click:
    MsgBox Err.Description, vbExclamation + vbOKOnly, conProgname
    Resume Exit_cmdOpenMailingForm_Click
   
End Sub
0
looper8
Asked:
looper8
1 Solution
 
looper8Author Commented:
OK I've solved this one myself!  Turns out that the Seek operation only works on an unsplit database.  So by changing Set rec = db.OpenRecordset("tblOrganisation")
 to Set rec = db.OpenRecordset("SELECT * FROM tblOrganisation WHERE OrganisationID = " & lst.Organisations), and deleting the rec.Index and rec.Seek lines all becomes well!
0
 
GranModCommented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now