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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Problem

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a Main Form displaying existing records and another form to add new record. How do I set up so When the new record is added, the Main form will open with the new added Record.

Thanks,
 
You can add a refresh button to the form to see the new information. But, what I have done that is more trick,on your main form make a button that runs a macro "on click" that tells it to close the main form and open the edit form, then create a button and macro on the edit form that closes the edit form and opens the main form. The main form will open with the new record...
 
What about setting the Form_Activate event to run the Requery method of the edit form?

What should happen is when the new record form closes and the edit form regains focus, the records should refresh. Wouldn't this be easier than creating a bunch of buttons and macros?
 
Either of the previous methods will cause the main form's recordset to include the new record. However, it seems to me you also want the main form to position to the new record. That takes more work, though it's easier in Access 2000 than Access 97. Which are you using?

One other question--why are you using a separate form to add a record? When you say you want to make the main form show the new record, it makes me think that both forms have the same Record Source property. In that case, the main form is perfectly able to accept the new record by itself. If you're doing this because you need to protect some controls from editing, but need them available when adding a record, you can use the Form_Current event to set their Locked and/or Enabled properties. You can tell that the user is adding a record by testing the form's NewRecord property. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top