|
-
May 8th, 2002, 03:55 PM
#1
Thread Starter
Lively Member
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
-
May 8th, 2002, 04:01 PM
#2
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.
-
May 8th, 2002, 04:03 PM
#3
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...
-
May 8th, 2002, 04:06 PM
#4
Thread Starter
Lively Member
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
-
May 8th, 2002, 04:55 PM
#5
You could use a timer control to refresh the datagrid at preset intervals.
VB Code:
Private Sub Timer1_Timer()
DataGrid1.Refresh
End Sub
-
May 8th, 2002, 05:03 PM
#6
Even better only refresh when the table size changes.
VB Code:
Option Explicit
Dim intStartRecordCount As Integer
Dim intNewRecordCount As Integer
Private Sub Form_Load()
intStartRecordCount = GetRecordCount
End Sub
Private Sub Timer1_Timer()
intNewRecordCount = GetRecordCount
'refresh datagrid if records were added or removed
If intNewRecordCount <> intStartRecordCount Then
DataGrid1.Refresh
intStartRecordCount = intNewRecordCount
End If
End Sub
Private Function GetRecordCount()
Dim dbs As Database
Dim rst As Recordset
Set dbs = OpenDatabase("<YourDatabaseNameHere")
Set rst = dbs.OpenRecordset("SELECT COUNT(*) as CountRecords FROM <table>")
GetRecordCount = rst!CountRecords
Set dbs = Nothing
Set rst = Nothing
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|