F
Fjordur
Hi,
I have a job form with a subform 'assign' which shows people assigned to the
job. The subform has a combo based on a query based on a 'person' table.
Adding a record to the sublist is done by selecting a person's name in the
combo. The property 'LimitToList' of the combo is true.
I want to be able to type a new name in the combo; in that case I want
the user to fill a "personForm" form and then go back to the assignment
form - subform. What I did is this: the property 'onNotInList' of the combo
is a Sub that does the following:
MsgBox("do you want to add a new name")
if answer is Yes then
DoCmd.RunSQL "INSERT INTO [personTable] ( personName) " & _
"VALUES ('" & NewData & "');"
intAnswer = Nz(DMax("[personID]", "[personTable]"), 0)
stLinkCriteria = "[personID]=" & intAnswer '& "'"
DoCmd.OpenForm "personForm", , , stLinkCriteria
The user can then fill the "personForm", then close it and find himself back
where he was, with the new name types in the combo, focus on the combo.
Problem is, I can't find how to refresh the combo list. It doesn't contain
the new name and therefore will not let you move the focus out of the combo
(it will ask again and again if you want to add the name). Ideally, I would
like the query of the combo to be re-run.
How can I do that?
I have a job form with a subform 'assign' which shows people assigned to the
job. The subform has a combo based on a query based on a 'person' table.
Adding a record to the sublist is done by selecting a person's name in the
combo. The property 'LimitToList' of the combo is true.
I want to be able to type a new name in the combo; in that case I want
the user to fill a "personForm" form and then go back to the assignment
form - subform. What I did is this: the property 'onNotInList' of the combo
is a Sub that does the following:
MsgBox("do you want to add a new name")
if answer is Yes then
DoCmd.RunSQL "INSERT INTO [personTable] ( personName) " & _
"VALUES ('" & NewData & "');"
intAnswer = Nz(DMax("[personID]", "[personTable]"), 0)
stLinkCriteria = "[personID]=" & intAnswer '& "'"
DoCmd.OpenForm "personForm", , , stLinkCriteria
The user can then fill the "personForm", then close it and find himself back
where he was, with the new name types in the combo, focus on the combo.
Problem is, I can't find how to refresh the combo list. It doesn't contain
the new name and therefore will not let you move the focus out of the combo
(it will ask again and again if you want to add the name). Ideally, I would
like the query of the combo to be re-run.
How can I do that?