I am trying to open a form to show all records which relate to the Logged in User only for a given date.
My form record source is linked to the table and I want to set a condition where the Table myID matches the current user Login Id. I have the following SQL Select statement.
The lngMyEmpID is captured at logon and declared as a public variable and is used elswhere without a problem. However, I am getting a paremeter box appearing when I open the form which wants me to enter the ID. I simply want the form to select records based upon the login ID matched to the myID field within the table.
My form does not appear to recognise the public variable and I dont understand why.
My form record source is linked to the table and I want to set a condition where the Table myID matches the current user Login Id. I have the following SQL Select statement.
Code:
SELECT tblRoomsBooking.BookLocation, tblRoomsBooking.BookStartDate, tblRoomsBooking.BookTime, tblRoomsBooking.BookEndTime, tblRoomsBooking.BookName, tblRoomsBooking.Faculty, tblRoomsBooking.myID FROM tblRoomsBooking WHERE (((tblRoomsBooking.BookStartDate)=[frmBookings].[BookStartDate]) AND ((tblRoomsBooking.myID)=[basMyEmpId].[lngMyEmpID])) ORDER BY tblRoomsBooking.BookLocation, tblRoomsBooking.BookStartDate;
My form does not appear to recognise the public variable and I dont understand why.
Comment