Just Date().
Sorry, the syntax for code in subform would be: Me.Parent.cboQuestion.Requery.
However, the subform record is not saving the QuestionID of the question selected in the combobox, it is saving the QuestionID of the main form record, which never changes. Apparently all the bookmark code isn't working. I thought it was because the searches use names, not IDs, but even after fixing that it isn't working. Mysterious.
An alternative is not to use a form/subform. Comboboxes and button would be in form Header section. Bind cboQuestions to QuestionID. Copy the subform controls into Detail section, delete the subform. Try Continuous form view, you might like.
Form RecordSource:
SELECT tblAnswers.*, tblQuestions.Questions FROM tblQuestions RIGHT JOIN tblAnswers ON tblQuestions.IDQuestions = tblAnswers.IDQuestions;
Have a textbox in the Detail section to display the question but set that box as Locked Yes, TabStop No.
Code behind form:
Code:
Option Compare Database
Option Explicit
Private Sub cboName_AfterUpdate()
Me.cboPortfilio.Requery
End Sub
Private Sub cboPortfilio_AfterUpdate()
Me.cboQuestion.Requery
End Sub
Private Sub Form_AfterUpdate()
Me.cboName = Null
Me.cboPortfilio = Null
Me.cboQuestion.Requery
End Sub
Private Sub btnClose_Click()
DoCmd.Close
End Sub
cboPortfilio RowSource:
SELECT tblPortfilio.IDPortfilio, tblPortfilioName.PortfilioName FROM tblPortfilioName RIGHT JOIN tblPortfilio ON tblPortfilioName.IDPortfilioName=tblPortfilio.IDPo rtfilioName WHERE (((tblPortfilio.IDStaff)=[cboName])) ORDER BY PortfilioName;
cboQuestions RowSource:
SELECT tblQuestions.IDQuestions, tblQuestions.Questions FROM tblAnswers RIGHT JOIN tblQuestions ON tblAnswers.IDQuestions=tblQuestions.IDQuestions WHERE (((tblQuestions.IDPortfilio)=[cboPortfilio]) And ((tblAnswers.IDAnswers) Is Null) And ((CDate(NZ([AnsDate],#12/31/2999#)))<>Date()));
Make sure you are on a new record row before selecting a question in the combobox. You will notice that the bound combobox will not show the question for existing records because the RowSource is a query with a lookup alias and that value is filtered out of the RowSource list. That's the reason for textbox to show the question.
Use debug techniques to analyse problems. Refer to link at bottom of my post for guidelines.