none
Web App Help RRS feed

  • Question

  • I'm working with the Training Management app from Microsoft. I've put the app up on my SharePoint site and I've done a significant amount of customizing in the stripped down desktop version of access. But I'm having trouble with one piece.

    The My Trainings view is a list details view of the Trainings table running on an Embedded Query which connects the Trainings and Enrollments tables. The enrollments table is a based lookup table. It's supposed to filter out the Enrollments to show only the classes that the current user is enrolled in but if a user ends up at the My Trainings view from anywhere other than the home page icon, they see all enrollments instead of just their own, this a problem because users could potentially unenroll others from courses, or see other's info.

    From the home screen, when a user clicks a button it runs a macro which runs a data macro that checks if the user exists, returns their ID number and then proceeds to Change the View to My Trainings where [Attendee] = [UserID]. This works, and I've hidden the view so that you can't really access if from elsewhere

    Here's what I've tried so far:

    I tried the same macro directly on the view, in the on load section. It tells me this: "Where clauses must contain at least one field reference that includes the table name. For example, "Contacts.Email". You may have specified the field name without a table name, which will resolve to the field's current value." 

    Macro Details: Arguments: Trainings, My Trainings, [Attendee]=[UserID]; Error Number: 2055

    That's fine except for the part where it worked in the other view, but ok, so I do what it suggests.

    The table name in this case would be [Enrollments].[Attendee] but when I try that nothing actually happens, I get the list with everyone's trainings and not just my own. I try adding the same code to the on current tab and still nothing happens.

    I figured this might be because of the "change view" portion of the macro. So I change that portion to requery records keeping the same parameters. In which case it gives me an error saying that I've put in an invalid field name.

    I'm not sure what it was expecting but I've tried several different field names, all spelled right from both the Enrollment and the Trainings tables, and I get the same error.

    Any suggestions?

    • Edited by RSantos7 Wednesday, February 10, 2016 7:57 PM clarification
    Monday, February 8, 2016 6:14 PM

Answers

  • Hi RSantos7,

    >>I tried the same macro directly on the view, in the on load section. It tells me this: "Where clauses must contain at least one field reference that includes the table name. For example, "Contacts.Email". You may have specified the field name without a table name, which will resolve to the field's current value." 

    Based on my understanding, this ChangeView macro doesn't work if the view is same as current view. As a workaround, we can hide the default views by hiding tables. And then create a different view and at the onload event of this view to filter the data and open the view we wanted.

    Hope it is helpful.

    Regards & Fei



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 12, 2016 11:50 AM
    Moderator