Инициализации формы:
SELECT namegroup FROM group INTO CURSOR group2
ThisForm.Combo1.RowSourceType= 2
ThisForm.Combo1.RowSource='group2.namegroup'
SELECT namesubject FROM subject INTO CURSOR subject2
ThisForm.Combo2.RowSourceType= 2
ThisForm.Combo2.RowSource='subject2.namesubject'
ThisForm.Combo4.RowSourceType= 2
ThisForm.Combo4.RowSource='subject2.namesubject'
SELECT degree FROM degree INTO CURSOR degree222
ThisForm.Combo5.RowSourceType= 2
ThisForm.Combo5.RowSource='degree222.degree'
ThisForm.Combo3.AddItem("3")
ThisForm.Combo3.AddItem("4")
ThisForm.Combo3.AddItem("5")
Нажатие на кнопку «Добавить группу»:
SELECT MAX(group.id_group) as m_group FROM group INTO CURSOR group_max2
INSERT INTO group(id_group,namegroup);
VALUES (group_max2.m_group+1,ALLTRIM(ThisForm.text7.Value))
SELECT namegroup FROM group INTO CURSOR group2
ThisForm.Combo1.RowSourceType= 2
ThisForm.Combo1.RowSource='group2.namegroup'
ThisForm.text7.Value=''
Нажатие на кнопку «Добавить предмет»:
SELECT MAX(subject.id_subject) as m_subject FROM subject INTO CURSOR subject_max2
INSERT INTO subject(id_subject,namesubject);
VALUES (subject_max2.m_subject+1,ALLTRIM(ThisForm.text8.Value))
SELECT namesubject FROM subject INTO CURSOR subject22
ThisForm.Combo1.RowSourceType= 2
ThisForm.Combo1.RowSource='subject22.namesubject'
ThisForm.text8.Value=''
Нажатие на кнопку « »:
SET PATH TO ('Forms\')
DO FORM getdataform
Нажатие на кнопку «Добавить уч.степень»:
SELECT MAX(degree.id_degree) as m_degree FROM degree INTO CURSOR degree_max2
INSERT INTO degree(id_degree,degree);
VALUES (degree_max2.m_degree+1,ALLTRIM(ThisForm.text10.Value))
SELECT degree FROM degree INTO CURSOR degree22
ThisForm.Combo5.RowSourceType= 2
ThisForm.Combo5.RowSource='degree22.degree'
ThisForm.text10.Value=''
Нажатие на кнопку «Добавить»:
SELECT MAX(courseworks.id_student) as m_id_student,MAX(courseworks.id_subject) as m_id_subject,MAX(courseworks.id_professor) as m_id_professor,MAX(courseworks.id_theme) as m_id_theme FROM courseworks INTO CURSOR courseworks_save
SELECT * FROM subject INTO CURSOR subject_save
SELECT * FROM student INTO CURSOR student_save
SELECT * FROM professor INTO CURSOR professor_save
SELECT * FROM degree INTO CURSOR degree_save
SELECT MAX(degree.id_degree) as m_degree FROM degree INTO CURSOR degree_max
SELECT MAX(group.id_group) as m_group FROM group INTO CURSOR group_max
SELECT MAX(subject.id_subject) as m_subject FROM subject INTO CURSOR subject_max
SELECT MAX(theme.id_theme) as m_theme FROM theme INTO CURSOR theme_max
SELECT MAX(student.id_student) as m_student FROM student INTO CURSOR student_max
SELECT MAX(professor.id_professor) as m_professor FROM professor INTO CURSOR professor_max
SELECT * FROM theme INTO CURSOR theme_save
SELECT * FROM group INTO CURSOR group_save
SELECT * FROM group WHERE group.namegroup=ALLTRIM(THISFORM.combo1.Value) INTO CURSOR selectgr
SELECT COUNT(*) as ct;
FROM 1!theme;
WHERE LOWER(TRIM(Theme.nametheme))==LOWER(TRIM(THISFORM.text9.value))
INTO CURSOR ttt1
IF ttt1.ct!=0 THEN
MESSAGEBOX(" Такая тема есть!!!")
ELSE
SELECT * FROM courseworks;
where ALLTRIM(courseworks.mark)=ALLTRIM(thisform.Combo3.value);
INTO CURSOR wer
INSERT INTO student(id_student,surname,name,patronymic,id_group);
VALUES (courseworks_save.m_id_student+1,ALLTRIM(ThisForm.text1.Value),ALLTRIM(ThisForm.text2.Value),ALLTRIM(ThisForm.text3.Value),selectgr.id_group)
INSERTINTO courseworks(id_student,id_subject,id_professor,datedelivery,mark,id_theme);
VALUES (courseworks_save.m_id_student+1,courseworks_save.m_id_subject+1,courseworks_save.m_id_professor+1,(Thisform.text12.Value),wer.mark,courseworks_save.m_id_theme+1)
INSERT INTO degree(id_degree,degree);
VALUES (degree_max.m_degree+1,ALLTRIM(ThisForm.Combo5.Value))
INSERT INTO professor(id_professor,surname,name,patronymic,id_degree);
VALUES (courseworks_save.m_id_professor+1,ALLTRIM(ThisForm.text4.Value),ALLTRIM(ThisForm.text5.Value),ALLTRIM(ThisForm.text6.Value),degree_max.m_degree+1)
INSERT INTO theme(id_theme,nametheme);
VALUES (courseworks_save.m_id_theme+1,ALLTRIM(ThisForm.text9.Value))
MESSAGEBOX(" готово!!! ")
ENDIF
Нажатие на кнопку «Показать темы»:
SELECT * FROM subject;
where ALLTRIM(thisform.combo4.value)=ALLTRIM(subject.namesubject) into cursor subfind
SELECT theme.id_theme, theme.nametheme, Courseworks.id_student,;
Courseworks.id_subject, Courseworks.id_professor,;
Courseworks.datedelivery, Courseworks.mark, Courseworks.id_theme;
FROM;
1!theme;
INNER JOIN 1!courseworks;
ON theme.id_theme = Courseworks.id_theme;
INTO CURSOR corrwork
SELECT * FROM corrwork;
WHERE subfind.id_subject=corrwork.id_subject INTO CURSOR corwork
ThisForm.List1.RowSourceType=2
ThisForm.List1.Value=''
ThisForm.List1.RowSource='ALLTRIM(corwork.nametheme)'
Getdataform – «Выбор даты»
Нажатие кнопки «Выбрать»:
y=YEAR(THISFORM.olecontrol1.SelEnd)
m=MONTH(THISFORM.olecontrol1.SelEnd)
ch=DAY(THISFORM.olecontrol1.SelEnd)
form2.text12.Value=DATE(y,m,ch)
THISFORM.Release