No Visual Feedback when Adding Member to Group

Hi Jo,

Now I understand why you want me to avoid multiple topics on a single thread. You have answered my question about error messaging on a new thread, but you did not answer the other topic on the thread “Form Page Designer Issues”. Here is a summary of the question I need:

However, your last reply only addresses the error messaging. It does not address the main issue, which is being able to add the same member multiple times to the group.

I couldn’t figure out how to use _lookupUnique on the process screen, so I would not see all members, just those not in the group. The best fix would be a lookup unique on the GroupMembers table, but somehow joined to the Members table so I could see all members except those already in the group in the Member drop-down of the process screen fields.

If this cannot be fixed, how do I implement checking for the presence of the selected member already in the current StudyGroup? My InsertGroupMemberServer function tries to do this but it is not working.

If I add a member to the group, then click the action button to add another member, It lets me choose to add the same member again. I have a lookup field for members when adding a new member to the group, but the lookup field is a simple lookup tied to the members table only. Therefore, it would let me add the same member multiple times.

I have another topic, “Problem Returning to Form After Adding Record”, which you have not yet answered. This describes the related issue, and shows why members may be being added multiple times to a group.

However, for this topic, I need to find a way to implement LookupUnique so it is not possible to add the same member twice to a group. Instead of basing the lookup on the Members table only, how do I base it on perhaps a join query which includes the GroupMembers table and also the Members table so I can get the names in the lookup? There is a LookupQuery type of field, but I’m not sure that is the answer. Mainly, in the drop-down I want to see all members, but only if they are NOT already in the group yet.

I hope this clears things up. Thanks for your patience with me!

Hi,
It’s been over 2 weeks. Any ideas on how to do this?

Hi Ron,

You need to use a LookupQuery instead of a Lookup. The query you need to use should be something like:

Select all members from the Members table that do not exist in the StudyGroupMember table.

This query must have a parameter for the column StudyGroupKey to ensure the members displayed do not exist in the StudyGroupMember table for the same group.

Kind regards,

Jo

Thanks Jo. I have added a new query called MembersNotInStudyGroup:

SELECT
  `m`.`MembersKey`, `m`.`FullName`
FROM
  `Members` AS `m`
WHERE NOT EXISTS (
  SELECT *
  FROM StudyGroupMembers s
  WHERE s.MemberKey = m.MembersKey
  -- AND s.StudyGroupKey = '38eb45d7-6892-4842-a9db-263a96655dce' -- Trekkies key
  AND s.StudyGroupKey = ?
)
ORDER BY `m`.`SortName`

When I run this query in design mode, after commenting/uncommenting the AND clauses, it properly shows members who are not in the group, and not those who ARE in the group.

Here is the screen showing that field in the GroupMembers form:

When I run the app and open the GroupMembers form, if I click the drop-down for members, the list includes people who are already in the group. I don’t understand what I’m doing wrong. Can you help? Thanks…

Hi Ron,

Could you please provide the right steps for your scenario:

This is what I understood:

After creating a new ‘Study Group’, I clicked on the button ‘Add’ to add a member, which took me to the process ‘Add Group Member‘, the field ‘MemberKey’ in this process is just a normal Lookup; therefore, all records will be displayed. so, the filter may need to be applied to this field.

The query ‘MembersNotInStudyGroup‘ is on a form, the field MemberKey of the form ‘Group Members‘, and this field is read-only.

I have the impression that the query ‘MembersNotInStudyGroup‘ is been used in the wrong spot, and it should be used in the process ‘Add Group Member‘, and the form ‘Group Members‘ should have just a normal lookup.

Could you please clarify the workflow?

Thank you.

Regards,
Elton S

Thanks Elton.

I think I made a mistake with my question. I thought Add Member button was opening the GroupMembers form directly. Forgot my own coding. You are correct, clicking AddMembers runs the AddGroupMember function which loads up variables and runs the AddGroupMember process. This is the one where I need to change to a _LookupQuery and use the MembersNotInStudyGroup query as the data source. This now works correctly.

The main reason behind this thread was that when I bring up the process to add a new member to the group, then click the Save checkmark, nothing happens to show me the member actually got added, so the user is tempted to add the same member again. When the member is added, this form leaves me in the process screen, and I now need to click the Cancel action button to return me to my original Study Groups form.

Now that you’ve shown me (in another thread) why I wasn’t automatically returning to the calling form, this particular thread has been solved. Thanks so much for your help!