pop up form

  • Thread starter Thread starter Ivor Williams
  • Start date Start date
I

Ivor Williams

I have a form with a combo box from which a Project is chosen. I f the
project is a new one, the NotInList event opens a pop up form in which the
new project information is entered. Closing the pop up form updates the
combo box and the user carries on. The code I'm using to do this is:

Private Sub Project_NotInList(NewData As String, Response As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewProject"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
Response = acDataErrAdded

End Sub

Currently the user has to click on the close button on the pop up form to
close it. Is it possible to add some code to the last control on the pop up
form to be updated so that hitting either the Enter key or Tab key will
close the pop up and still update the combo box?

Ivor
 
You could try using the AfterUpdate event of the last control, but be sure
to verify that all other required data has been filled in. Perhaps the
easiest way would be to force a SaveRecord inside an error trap followed by
a form close. Don't close the form if the save gets an error. Put your
validation code in the form's BeforeUpdate event and cancel the save if
something is amiss.

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
Back
Top