Results 1 to 9 of 9
  1. #1
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102

    Eror locating table after splitting database to front and backend

    This line is throwing up as an error after splitting the database.



    Set MySet = MyDB.OpenRecordset("keydata", dbOpenTable)

    Should there be an amendment to the programing?

    This is the full module.

    Sub UpdateKeyData(RecordNo As Long, NewData As String)
    Dim MyDB As Database, MySet As Recordset
    Set MyDB = CurrentDb()
    Set MySet = MyDB.OpenRecordset("keydata", dbOpenTable)
    MySet.Index = "PrimaryKey"
    MySet.Seek "=", RecordNo
    MySet.Edit
    MySet!fieldone.Value = NewData
    MySet.Update
    Debug.Print "UpdateKeyData: Record " & Format(RecordNo, "#") & " changed to " & NewData
    MySet.Close
    End Sub

    Thanks

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    for your code to work either the keydata table itself or a linked table needs to be in the current db. check you can see the table in the current data base, and if linked that you can see the data when you open it to check the link is working OK

  3. #3
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    Hi Ajax, yes all the linked tables are visible and can open the table to view the data.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    OK what is the error description? - I suspect dbOpenTable is what is causing the problem. Suggest remove it and use the default (i.e. leave blank) or change to dbOpenDynaset - see this link about openrecordset and linked tables

    https://msdn.microsoft.com/en-us/lib.../ff820966.aspx

  5. #5
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    Hi, I get a run-time error 3219 invalid operation

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    did you follow my advice and read the link I provided re dbOpenTable?

  7. #7
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    Hi yes I did, but with my little knowledge I couldn't work out how to amend my code. That code earlier was not written by me.

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    ????? what is difficult about changing

    Set MySet = MyDB.OpenRecordset("keydata", dbOpenTable)

    to

    Set MySet = MyDB.OpenRecordset("keydata")

  9. #9
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    Haha thanks, I see it now.

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

Similar Threads

  1. Replies: 4
    Last Post: 01-14-2016, 11:03 AM
  2. Replies: 2
    Last Post: 11-05-2013, 09:00 AM
  3. Replies: 0
    Last Post: 02-06-2013, 03:23 AM
  4. Replies: 5
    Last Post: 11-13-2012, 12:16 PM
  5. Replies: 1
    Last Post: 10-03-2012, 11:15 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