problems appending records with unbound textboxes in main/subforms

dayna

Registered User.
Local time
Yesterday, 19:25
Joined
Nov 10, 2007
Messages
39
I apologize for yet another thread on tracking student attendance, but I’ve been struggling with this data entry form for longer than I care to admit. What I’ve been able to piece together so far seems to work (under limited circumstances and with a lot of assuaging), but there are several flaws in the form that I can’t seem to solve. In addition to posting the relevant parts of my DB, I’ll try to explain what I’ve got:

First, I have an unbound form named Attendance with three fields:
[Select Class] (Combo box)
[Date] (textbox)
[Contact Hours] (DLookup from Classes table; will be invisible to users)

My subform is based on a query that displays the last and first names of active students who are enrolled in the selected class. I also have an additional unbound textbox in my subform for each student’s contact hours (or hours spent in the classroom on any given date). The default value of this textbox is set to the [Contact Hours] field in my main form.

My first problem is that when the Attendance form is first opened, #Error is displayed in the [Contact Hours] field of my subform. The strange thing is, when I switch to design view, and then back to form view, the subform works perfectly well. Yet, when I close the form and open it again, I get the familiar #Error until I change views.

Secondly, although the [Contact Hours] field on my main form updates beautifully when the [Select Class] combo is changed, the [Contact Hours] field in the subform does not refresh/requery. Again, it only works properly if I select a class, switch to design view, and then switch back to form view. All of the other fields requery just fine without switching views.

As if that weren’t enough, the [Contact Hours] field on my subform will not allow me to input a different value for each student. Even after I cajole my form into displaying the [Contact Hours] default value properly, once I change the contact hours for one student, that change cascades for every student in the class! Aggghhhh!

If we assume the impossible, i.e., that each student comes to class on time every day and accrues the same number of hours, my form appends these records to the attendance table quite nicely. The problem is that this never happens, and I’m tasked with tracking each student’s actual hours spent in the classroom, rounded to the nearest fifteen minutes.

I’ll spare you the litany of things I’ve tried and tutorials I’ve followed. I realize that there are probably some major problems with my approach, but this works better than anything else I’ve come up with over the course of the last month. Any ideas? Thanks so much!
 

Attachments

Well, the plan was to use the form data in an append query that will store new attendance records in the Attendance table. I just can't seem to hammer out the whole [Contact Hours] thing.

I would like for my attendance form to display a list of all the students in a selected class. Next to each student's name, I would like to have some kind of control that will accept each student's contact hours for a specified date. I would like the value of that control to default to the number of hours that the selected the class meets. (This data is stored in the Classes table as [Daily Contact Hours].) This would cut down on data entry time because teachers would only have to modify rows in cases of absences or tardies.

The problem is that if I make [Contact Hours] a calculated field on the underlying query, I can't modify the value in the form. If I set up the form so it contains nested subforms (Classes --> Students --> Attendance), I can't seem to get the form to look right, where the contact hours control aligns with the student name control.

As I write this, I'm getting an idea, so I'll go try it out. Let me know if you've got any suggestions. Thanks!
 
Thanks, Pat, for your reply. Door #2 is definitely what I’m after, I just can’t seem to figure out how to get there. When I base my form on the attendance table, I have a lot of trouble populating student names by class, among other issues. I’ve tried basing my Student Name controls on a query and the Contact Hours control on the attendance table, but when I do this, Access changes the form to “single” when what I want is “continuous.”

As for the idea I spoke of, it didn’t work out. I’m still stuck in the same place. Any suggestions?
 

Users who are viewing this thread

Back
Top Bottom