Hi everyone,
I’m new to this forum so please be patient with me .
My database in short:
- I have three tables (StudentsT-StudentID(PK),FName,LName);(StudentListT-StudentListID(PK),StudentID,ClassID);(ClassT-ClassID(PK),CName)
- I have Parent Form ClassF (main form) and StudentListSubF (which is subform of this ClassF), where users can select which students will be in some class-so it will create a list of students. StudentListSubF is a continuous form and students can be selected using cboStudentID combobox.
I’m looking for any way how to do this:
-use cboStudentID combobox (preferably) to check if the children (subform) record is a new record and then show a simple message.
When I enter a new record using cboStudentID combobox, message will be something like “New record entered”. But, when I want to change previous record to another student using same combobox, I’d like to see message “Record updated”.
I tried to put this vba code into my cboStudentID AfterUpdate event. But it shows only “Record updated” message in both cases. My code is:
I can also upload my simple DB for better understanding.
Thank you very much for any help.
Martin
I’m new to this forum so please be patient with me .
My database in short:
- I have three tables (StudentsT-StudentID(PK),FName,LName);(StudentListT-StudentListID(PK),StudentID,ClassID);(ClassT-ClassID(PK),CName)
- I have Parent Form ClassF (main form) and StudentListSubF (which is subform of this ClassF), where users can select which students will be in some class-so it will create a list of students. StudentListSubF is a continuous form and students can be selected using cboStudentID combobox.
I’m looking for any way how to do this:
-use cboStudentID combobox (preferably) to check if the children (subform) record is a new record and then show a simple message.
When I enter a new record using cboStudentID combobox, message will be something like “New record entered”. But, when I want to change previous record to another student using same combobox, I’d like to see message “Record updated”.
I tried to put this vba code into my cboStudentID AfterUpdate event. But it shows only “Record updated” message in both cases. My code is:
Code:
Private Sub cboStudentID_AfterUpdate()
If IsNull(Forms!ClassF!StudentListSubF!StudentID) Then
MsgBox "New record entered."
Else
MsgBox "Record updated."
End If
End Sub
I can also upload my simple DB for better understanding.
Thank you very much for any help.
Martin