Messages to Users / Filter what shows by user

dgreen

Member
Local time
Today, 17:33
Joined
Sep 30, 2018
Messages
397
Imagine you has some messages you want your users to see. This form would keep showing them, until the user clicked on the trash button (hiding that message but only for that individual).

See the attached database to see my starting point.

With multiple users, how do I show all of the messages in t_Msg, unless the user has clicked the trash icon (which runs an INSERT sequence)? This works with one user but with more than one, my query is missing something.

I identify my users using the WinUser name at this point.

1585018263075.png
 

Attachments

for multiple users, you need to make sure all
fe on each user has Local copy of t_Msg_Contact_Relationship table.
therefore when the query runs it only check the local db.
 
I do something very similar using two tables.
.

Main Table: Messages:
Child table: Messages Views

The Message Views table is a log of when each user views, in your case trashes, a message with a date/time stamp and the Computer name.

The Message View table looks something like this:

MessageVieweddKey - primary key - auto number
MessageKey - a foreign key to the messages table
UserID (in your case the WinUser)
ViewedDate - set to Now()
OSComputerName
OSUserName

To show messages not seen by a user., show all messages where there is not a related record for the user in the Message Views table. The query wizard calls this an Unmatched query.

When the user marks a message as viewed (trashed in your case), run VBA code to append a record to the Message Views table.

TIP: The way Access stores data, the Message Views table can have 10,000 records and use about a 1 meg of space the database.
 
@bastanu Nice capability.

Is the popMDB_Messages supposed to popup when I double click on a message line? How did you envision it being used?

Did you consider using a check box or something other than clicking on the UserName line to select more than one but less than everyone to send a message to?

Is there a way to chat with someone that isn't logged in (leave a message for them somehow)?

Using the UserName, if there are 2 people with the same first and last name, do you know how the code would display the names? If they were the same, how would you differentiate them?

 
Last edited:
Hi sorry for the delay in getting back to you, I originally did it for a student database where different operators where entering related data for students in different forms (agents, homestay, payments, classes, attendance) and they needed a quick way to exchange info about a particular student. It was also used in conjunction with a db shut-down feature to inform all users of upcoming maintenance.

Yes, you could add a check-box to select multiple users, fairly simple to do and also you could modify it to send a message to a user that is not logged in (you will need a modified logging in procedure that would list all users from the user table and a status (Logged ON, Logged OFF). Then you will modify the chat queries to not delete messages for the logged off users.

Cheers,
 
you might want also consider using and saving the actual IP address of the user and not the UserName.
IP address are unique while there maybe several users having same username on their local computer.
 

Users who are viewing this thread

Back
Top Bottom