Results 1 to 10 of 10
  1. #1
    serenechaos is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    13

    Displaying 20 query results on 20 text boxes

    Hi,


    I am trying to change the text of a number of text boxes on a form - I want each text box to display one item of a query which returned 20 items - so 20 text boxes, each displaying one of the query table items.


    For textbox1, as a start, i've tried setting the control source, but keep getting #Name? displayed in the text box. What am I missing?

    (Here are a few of my attempts):


    =[AttQuery]![StName]
    =DLookUp(["1"],[AttQuery]![StName])

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    If I read your post correctly, the query returns 20 records and you want to display one field from each record in 20 textboxes.
    Not a good idea for a number of reasons including unnecessary complexity.
    Also what if there are 21 records next time?

    Suggest scrapping that idea and instead output query results to a listbox
    This can show any number of records and also if required more than one field
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    serenechaos is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    13
    Hi, it's for a daily attendance tracker - I want the form to display the 20 attendees and then mark them present/absent/other on the form for different periods of the day. The number of attendees change, but it's never more than 20.

  4. #4
    serenechaos is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    13
    Hi, it's for a daily attendance tracker - I want the form to display the 20 attendees and then mark them present/absent/other on the form for different periods of the day. The number of attendees change, but it's never more than 20. I might change the system later on - for now I'm still very fresh in Access so I'm trying to get to the bottom of this problem so I can learn from it, whether I use the current system or not.

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    create a continuous form with your query as the recordsource. drag the field or fields as required into the detail section

    It will display as many or few attendees as are available

    to create the form automatically, select the query, then in the ribbon go to the create ribbon then either select the form wizard and follow the prompts or under more forms, select multiple items

    in edit view you can then move your columns around, resize or delete them if not required

  6. #6
    serenechaos is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    13
    Ah thanks Ajax! So I've managed to get the IDs and names displayed on the form and have resized them. Now to get attendance slots next to the names (e.g. check boxes for absence in 3 periods of the day), am I right in thinking I just lay out the check boxes next to the names and then take the user input from those text boxes and feed that to a new table (i.e. if a user checks one of the check boxes next to Andrew, it will record that Andrew was absent in the breakfast period on 25 Feb in an absence log table), right?

  7. #7
    Join Date
    Apr 2017
    Posts
    1,792
    On base what I did read out from your posts, you need:

    1. An Employee registry table, p.e. tblEmployees: EmployeeID, FirstName, LastName, WorkingFrom, WorkingTo,...;
    2. Optionally, a calendary table, p.e. tblCalendary: CalDate, IsWorkday, ...;
    3.a) A table for working time registering, p.e. tblWorktime: WTID, CalCate, EmployeeID, WorkStart, WorkEnd, BreakFStart, BreakFEnd, ... (when only a single entry for a worker on a day is allowed);
    3.b) A worktime log, p.e. tblWorktimeLog: WTLogID, CalDate, EmployeeID, EntryType, EntryTime, ... (allows to register several work periods on same day, or being ill/on travel/on leave, etc.).

    The form you are discussing belongs to point 3, and it looks like you are going for variant a.

    In this case I think at 1st opening of database, an OnOpen procedure for application must generate missing rows into tblWorktime running INSERT query like (assumed tblWorktime.WTLogID is autonumeric, and you have tblCalendary)
    Code:
    INSERT INTO tblWorktime
    cal.CalDate, empl.EmployeeID
    SELECT 
    FROM tblEmployees empl INNER JOIN tblCalendary cal
    WHERE
    cal.CalDate >= empl.WorkingFrom
    AND
    (cal.CalDate <= empl.WorkingTo OR emplWorkingTo Is Null)
    AND
    cal.IsWorkday
    AND
    cal.CalDate Not IN (SELECT CalDate FROM tblWorktime)
    User registers all movements on form based on tblWorktime. A possible design:
    Single Main form based on tblCalendary, p.e. fCalendary, which by default activates the record for current date. You can have there a navigation combo to select any of earlier dates too, when you want to allow this for user;
    A continous form like adviced by Ajax, p.e. fWorktime, as subform of fCalendary. Subform is linked to main form on source table fields [CalDate] in both forms. So a list of all employees at date active in main form is displayed;
    User enters (current) time into any of controls linked to fields WorkStart, WorkEnd, BreakFStart or BreakFEnd. On leaving the record, the entry is saved into tblWorktime.

  8. #8
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    You said the register needs to have at least 3 options Present/Absent/Other
    Therefore I suggest that you don't use checkboxes as these only give you two options

    Below is an attendance register form I use for schools - lesson or session attendance
    The allowed inputs are / or \ for Present (am/pm), O for absent, L for late, M for medical etc.
    A combo box is used so staff are guided in their choice.

    Click image for larger version. 

Name:	AttendanceRegister.PNG 
Views:	20 
Size:	280.4 KB 
ID:	32759

    Additional info can also be added and student photos can be viewed.
    It only contains one lesson per form as the classes vary each lesson
    If yours stay the same for each period, you could obviously have columns for each on the same form

    Not all of that is relevant to you but it may give you ideas on how to do this

    One word of warning - do not store the data in multiple fields (columns) as though it was a spreadsheet.
    To ensure normalised data each record in the attendance marks table should contain an ID and ONE lesson/period mark ONLY

    The form shown above uses a crosstab query for the data source
    However crosstab queries are READ ONLY so a temp table is created based on the crosstab for use on the form.
    The attendance data is then saved back to the main table.
    It sounds complicated but is instantaneous in practice as far as end users are concerned
    Last edited by isladogs; 02-25-2018 at 06:40 PM.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  9. #9
    serenechaos is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    13
    ridders52 that looks amazing and shows almost exactly all the features I need to implement. Off to learn crosstab queries then! Do you have a password input box connected to the teacher initials drop-down / is that possible / what authentication did you implement? My attendance sheet would be a daily one with diffferent instructors in different periods but each day has the same periods at the same times. Instructors sometimes cover for each other (so on paper sign in their boxes for a period) and heads of department / other trainers sometimes make changes to the absence information, then on paper the change is recorded with a note and signature on the side - so i'm thinking whenever the instructor id changes it asks for a password so that the person making changes is identified in a column to the right.

  10. #10
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Quote Originally Posted by serenechaos View Post
    ridders52 that looks amazing and shows almost exactly all the features I need to implement. Off to learn crosstab queries then! Do you have a password input box connected to the teacher initials drop-down / is that possible / what authentication did you implement? My attendance sheet would be a daily one with diffferent instructors in different periods but each day has the same periods at the same times. Instructors sometimes cover for each other (so on paper sign in their boxes for a period) and heads of department / other trainers sometimes make changes to the absence information, then on paper the change is recorded with a note and signature on the side - so i'm thinking whenever the instructor id changes it asks for a password so that the person making changes is identified in a column to the right.
    It's part of a much larger schools database used for reporting, pastoral issues, exam results etc
    Staff login with user name and password so the system knows who is logged in.
    It also has all class and student info stored ready for the registers and other purposes
    Staff covering lessons use this form as well
    However if external supply teachers are covering a lesson, they are given a paper copy which is then entered onto the dB by admin staff

    If you want more info, send me an email using the link in my signature line.
    I'll then send you a PDF describing how it works. A DEMO version is also available on my website (no code)
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Displaying results of query in form text boxs
    By mgillespie21234 in forum Queries
    Replies: 3
    Last Post: 08-08-2015, 09:36 AM
  2. Replies: 1
    Last Post: 07-08-2015, 11:00 AM
  3. Replies: 3
    Last Post: 07-21-2014, 04:02 PM
  4. Replies: 3
    Last Post: 12-17-2013, 05:14 AM
  5. Replies: 0
    Last Post: 06-15-2011, 07:02 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums