Create new record in other form

Jerome

Registered User.
Local time
Yesterday, 20:56
Joined
Jul 21, 2009
Messages
77
Hello,

I have a data-table. Using a search-form (FrmSearch) I populate data in a listbox (in the search-form). When a user double clicks a row in the listbox a new form (FrmEditNewRecord) is opened to edit the row.

On the search-form is also a button where a new record can be created. Basically this is the same form (FrmEditNewRecord) as the edit form except the control source is different.

The only problem is when I want to make a new record the following line of code has to be included in the Form_open of the FrmEditNewRecord :

Code:
DoCmd.GoToRecord , , acNewRec ' This created a new record.

the only problem is I only want to do this when the button "new record" is clicked and not when the listbox is double clicked (for editing a record).

Placing the code under the BtnNewRecord_click in the FrmSearch does not work.

Whats the solution?

Thanks in advance.
 
Use the OpenArgs.

On Form A when opening Form B:

DoCmd.OpenForm "FormB", , , , , , "Not New"

On Form B Open Event:

If Not IsNull(Me.OpenArgs) Then DoCmd.GoToRecord , , acNewRec
 
Thanks :) this solves the problem.
 

Users who are viewing this thread

Back
Top Bottom