pop up form

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
 
J

John Viescas

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top