Can I get a subform to do this?

  • Thread starter Thread starter DebbieG
  • Start date Start date
D

DebbieG

I don't know if what I want to do is even possible. Seems like it should be
but I cannot figure it out.



Here are my tables:



Events: EventID

EventDate

EventType



Students: SSN

LastNM

FirstNM

LastSerDT



EventsStudents: SSN

EventID

EventStatusCD (P,A,E)



EventsStatusCD: EventStatusCD

EventStatusNM (Present, Absent, Excused)



My main form shows the fields from the Events table.



On the subform I want to show all the students where LastSerDT is null
(students that could attend an event) and then be able to select an
EventStatusCD (a combobox) for the EventID shown on the main form. If I
select an EventStatusCD for a student not currently in the EventsStudents
table for this EventID, then I want it to append to the EventsStudents
table. If I change a saved EventStatusCD for a student already in the
EventsStudents table for this EventID, then I want it to update the
EventsStudents table.



I have played with this all day and not coming up a solution. Is this
possible?



Thanks in advance,

Debbie
 
The easiest thing I can think of is to simply add a query to the
_After_Update() event of the subform combobox.

'Note this assumes you have a textbox with the EventID in the Parent form
(even if it's invisible).

Private Sub YourCombo_After_Update()

CurrentDb.Execute("INSERT INTO EventsStudents (SSN, EventID,
EventStatus) VALUES (" & Textbox_SSN & "," & Me.Parent.TextBox_EventID &
"," & YourCombo & ")")

End Sub

If I understand your question correctly that should work for you,
Eric Dreksler
 
Before I try this, would this insert records into EventsStudents table
without an EventStatusCD?


"Eric Dreksler" <ericd AT accessoneinc DOT com> wrote in message
The easiest thing I can think of is to simply add a query to the
_After_Update() event of the subform combobox.

'Note this assumes you have a textbox with the EventID in the Parent form
(even if it's invisible).

Private Sub YourCombo_After_Update()

CurrentDb.Execute("INSERT INTO EventsStudents (SSN, EventID,
EventStatus) VALUES (" & Textbox_SSN & "," & Me.Parent.TextBox_EventID &
"," & YourCombo & ")")

End Sub

If I understand your question correctly that should work for you,
Eric Dreksler
 
Back
Top