Results 1 to 3 of 3
  1. #1
    daveinuk is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    4

    Updating a form after inking to a new backend database

    Hi,

    Hope someone can help.

    I have an Access DB with a form that allows the user to select a new backend database. I can connect to the backend and then .refreshlinks but nothing on the form is updated. I have tried requiring the form but that doesn't do anything. I've tried loads of other things, refresh, recalc etc., but nothing updates the open form.

    The only way I have managed to get it to work is to close the form and reopen it, then it shows the data from the newly linked backend database.

    While it works, it doesn't look good but also there seems to be some problem with it because eventually it reports an error saying "cannot open any more databases" and when clicking OK comes back with "An error occurred while sending data to the OLE server (the application used to create the object" and a whole bunch of other messages.



    I think it might have something to do with the fact that the form has a number of MS graphs open on it, but I'm not sure. Also, I can't track down a particular line of VBA code which causes this error.


    Anybody got any thoughts on this and particular how to update a form after changing the backend database.

    Many thanks in advance
    Dave

  2. #2
    g4tv4life is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2014
    Posts
    50
    Showing us the code will be beneficial. I'd try both me.refresh and me.requery statements at the end of your code and see if that does the trick.

  3. #3
    daveinuk is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    4
    Hi G4tv4life,

    I already tried those options and nothing happens.

    Here is the code:

    For Each Tdf In dbs.TableDefs
    '
    ' if local then skip
    If Len(Tdf.Connect) <> 0 Then
    '
    ' The table is linked so check for a change
    If Right(Tdf.Connect, Len(Tdf.Connect) - InStr(1, Tdf.Connect, "DATABASE=") - 8) <> strFilename Then
    '
    ' Different link, so setup required link
    Tdf.Connect = "MS Access;PWD=*************;DATABASE=" & strFilename
    Tdf.RefreshLink
    End If
    End If
    '
    Next


    Thanks
    Dave

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

Similar Threads

  1. Password Protecting the backend database
    By data808 in forum Security
    Replies: 7
    Last Post: 02-24-2014, 10:45 AM
  2. Replies: 4
    Last Post: 08-31-2012, 12:55 PM
  3. Replies: 2
    Last Post: 07-03-2012, 11:46 PM
  4. Replies: 1
    Last Post: 01-12-2012, 09:43 AM
  5. Sharepoint Lists vs Web database as backend
    By is49460 in forum SharePoint
    Replies: 1
    Last Post: 10-28-2011, 04:27 PM

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