Results 1 to 6 of 6

Thread: Access response

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    89

    Access response

    If someone insert a row in a DB, is it possible to send back the info to every person that is connected to this table.

    ie:
    (2 users connected on the DB)

    user_1 insert a row in the DB

    user_2 program update the liste of record automatically because a row as been insert in the DB ...

    ??????????? thx in advance
    BlahDoS . :P

  2. #2
    joan_fl
    Guest
    Off hand I dont think so... but the application could poll another table that got updated with a record cout of the table in question.

  3. #3
    Alain
    Guest

    Well...

    I guess you could but you would need to add quite a few functions to your app including winsock functions (assuming you would use TCP/IP to comunicate).

    You would also need some sort of server app to have a list of users using your app.

    But I'm afraid there is no easy answer on this, meaning you won't resolve this one with 2 or 3 lines of code...

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    89
    Well, thank you for the answer

    I though there was a function in Access but ... It doesn't matter it was just somekind of feature but it might be interesting in the futur ............ if anyone got an idea just throw it
    BlahDoS . :P

  5. #5
    Armbruster
    Guest
    You could use a timer control to refresh the datagrid at preset intervals.

    VB Code:
    1. Private Sub Timer1_Timer()
    2.     DataGrid1.Refresh
    3. End Sub

  6. #6
    Armbruster
    Guest
    Even better only refresh when the table size changes.

    VB Code:
    1. Option Explicit
    2.  
    3. Dim intStartRecordCount As Integer
    4. Dim intNewRecordCount As Integer
    5.  
    6. Private Sub Form_Load()
    7.     intStartRecordCount = GetRecordCount
    8. End Sub
    9.  
    10. Private Sub Timer1_Timer()
    11.     intNewRecordCount = GetRecordCount
    12.     'refresh datagrid if records were added or removed
    13.     If intNewRecordCount <> intStartRecordCount Then
    14.         DataGrid1.Refresh
    15.         intStartRecordCount = intNewRecordCount
    16.     End If
    17. End Sub
    18. Private Function GetRecordCount()
    19.     Dim dbs As Database
    20.     Dim rst As Recordset
    21.     Set dbs = OpenDatabase("<YourDatabaseNameHere")
    22.     Set rst = dbs.OpenRecordset("SELECT COUNT(*) as CountRecords FROM <table>")
    23.     GetRecordCount = rst!CountRecords
    24.     Set dbs = Nothing
    25.     Set rst = Nothing
    26. End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width