Help getting a subform to open to a new record when a button is clicked

jd9913

Registered User.
Local time
Today, 09:08
Joined
Sep 12, 2012
Messages
14
Hi,

I have a subform [ctrlLogDetail] on a parent form [incidentdetails] that is opened by the user when they click on a button on a navigation form. These forms are used for a variety of purposes. The problem I'm having is that the user needs to be able to select an incident number and go to the appropriate form (I accomplish this by using this code: DoCmd.OpenForm "IncidentDetails", acNormal, , "Activity_ID = " & Me.cboINum in the on click event of the button.) This works appropriately. The subform is also appropriately linked to the parent form.

I need an additional line of code to have the subform go to a new record when the form opens to an existing incident number. Since I use this form/subform when doing different tasks, having the Docmd.RunCommand acCmdRecordsGoToNew in the Form on open event isn't optimal.

I only want the LogDetail subform to open to a new record when the user wants to add an entry, but not when they need to edit a specific entry. Can someone please assist with the appropriate syntax to use either in the openargs event of the openform command or elsewhere in the procedure so that the gotonew function on the subform only occurs when this button is clicked? I'm having difficulty getting access to understand that I want the subform to open to a new record but not the parent form.

Thanks for any assistance.
Jennifer
 
A little confused description, I could not find anything describing the difference between how you opened the form to edit the record or how to open the form to add a new record.
One way to do that is to set the form's property "Data Entry" to "Yes" when you want to add a new record, you can do that in the form's "On Open" event.
 

Users who are viewing this thread

Back
Top Bottom