Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return to the last record of a form when closing another form

Status
Not open for further replies.

jimger

Technical User
Jan 20, 2005
10
US
Hi -
I'm very new to Access, and have gotten a lot of information from these forums. I have a small database that is used to record school attendance for children. The user enters names and other information on a form, and chooses one of the area schools from a combo box on the form. I want the user to be able to add a new school if need be, and I've successfully used the information in FAQ702-4283 to enable the user to add a school to my school names table. The user enters the school name - if it's not on the list, a school name form opens for him to add the school to the list. When the user closes the new form, however, he's taken to a new record on the main form, instead of the record he's entering. I know that there's a way to get Access to do what I want, but I don't know what that way is. Can anyone help?
 

How are you opening and closing the new form? If you haven't closed the main form, it should remain open at the record you were on.


Randy
 
I'm closing the new form by clicking on the Close button at the top of the form - the main form is also open. The main form doesn't close, but goes to a blank record.
 
Any chance you could post your actual code in the NotInList event procedure of the school combo ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sure -
Don't imagine for a moment that I made this up on my own; it's copied from the FAQ that I mentioned in my original post.

Private Sub cboSchoolName_NotInList(NewData As String, Response As Integer)
If MsgBox("Add a school?", vbYesNo, "Warning") = vbYes Then
DoCmd.OpenForm "frmSchool", acNormal, , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top