Results 1 to 6 of 6
  1. #1
    mohrah is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Mar 2024
    Posts
    1

    database querry linked to external acces databae

    i have a table that is linked to another access file on the same pc,i run a querry to filter the table,i use an on timer event procedure to refresh data every 20 seconds (20000ms),this works fine when the two file are on the same pc but i put one of the them on another pc and update the link,i get an error when the refresh happens "The expression On timer you entered as the event property setting produced the following error: * The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
    * There may have been an error evaluating the function, event, or macro.

    the code i use as the event procedure is

    Private Sub Form_Timer()
    Me.Recordset.Requery
    End Sub



    the timer is set to 20000ms

    what could be the cause of the error
    thanks

  2. #2
    Join Date
    Apr 2017
    Posts
    1,681
    Are both computers in some home network, or in some LAN?

    When in LAN, then store both Access files in some network resource in LAN, where users of both computers have access to, and open them from there;
    When in home network, and there is a shared resource accessible from all family computers, put those Access files there, and continue as above;
    When in home network, and there isn't any shared resource accessible from all family computers, set it up (you need a router with USB port, connect an USB memory device there, and set it up as shared resource), and put those Access files there. After that continue as above.

    (The problem with connecting files on different local computers is, that they can be switched off, or in case of laptops, they can be elsewhere and not accessible. Having files on shared resource avoids the problems caused by such situations.)

    Now about your data refreshing problem. When you have both files on shared resource, why don't you simply link the table in 2nd database into your 1st database, and use it there as any other table there? Any queries from linked table are returning latest currently saved data from 2nd database (and anyway there is no way to get new data from 2nd database, when the changes were made in other computers RAM and were not saved jet).

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    for testing, what happens if you don't use the timer and just have a command button with Me.Requery in the event? Does it still error?
    Where and when are you applying the filter?
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    dblife's Avatar
    dblife is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2011
    Location
    South Shields, UK
    Posts
    104
    Using a timer to refresh every 20 seconds doesn't feel like a very elegant way to requery anything.
    As moke123 says, is there not a way to only check the data when an event happens?
    Opening a form or report or clicking something?

  5. #5
    Edgar is online now Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    This is the kind of stuff you turn to the debugger for. When an error pops up, hit debug and take a look at your variables using either the locals window or the watch window for more control.


    1. First off, make sure you've got that 'Me' variable loaded, and then see if it's got a recordset.
    2. Take a good look at your connection when it's working fine, and compare it to how it appears when it's not working.
    3. Keep going through other loaded elements. It might seem like a lot, but if you use some common sense, it's not hard. For example, if you're troubleshooting a connection problem, you wouldn't waste time inspecting colors and border styles, right?

    Now, if you've never debugged your app or played with the locals window or the debug option, all of this might sound like a mess. But believe it, looking under the hood like this will give you the right answer about 99% of the time.
    Please click on the ⭐ below if this post helped you.


  6. #6
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    In your code, do you use non-standard references to libraries? Maybe on the second PC the used library is not installed. Check on the second computer if there are missing references in the VBA window.

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

Similar Threads

  1. Adding data to an external linked table
    By Toasty in forum Import/Export Data
    Replies: 2
    Last Post: 06-12-2014, 07:10 AM
  2. Replies: 1
    Last Post: 05-29-2013, 03:08 PM
  3. Linked Database with 2 external Sources?
    By andersonEE in forum Import/Export Data
    Replies: 1
    Last Post: 07-16-2011, 05:52 PM
  4. Replies: 5
    Last Post: 11-28-2010, 03:55 PM
  5. acces listbox hatası(acces debug)
    By carso in forum Access
    Replies: 1
    Last Post: 09-22-2009, 04: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