Create/Advance to next record after entry

Create/Advance to next record after entry

am 16.10.2007 14:30:43 von gavm360

Hello,

I have a data entry form that has a button to copy the values of
fields (CASECODE,STEPDES,CBOANSWER) into the fields
(CASECODE,STEPDES,ANSWER) of a subform on the page.

Private Sub cmdANSWER_Click()
Forms!FRMMENU1!FRMANSWERSsubform![CASECODE] = Forms!FRMMENU1!
[CASECODE]
Forms!FRMMENU1!FRMANSWERSsubform![STEPDES] = Me![STEPDES]
Forms!FRMMENU1!FRMANSWERSsubform![ANSWER] = Me![CBOANSWER]
End Sub


After this is done i would like it to automatically advance the
subform (FRMANSWERSSUBFROM) to the next record so that I can add
multiple entries into it. Can someone help here?

Also, when the main form loads how do i have the subform startup on a
NEW record?

Thanks for your help! Gavin

Re: Create/Advance to next record after entry

am 16.10.2007 17:29:37 von Salad

gavm360@yahoo.com wrote:

> Hello,
>
> I have a data entry form that has a button to copy the values of
> fields (CASECODE,STEPDES,CBOANSWER) into the fields
> (CASECODE,STEPDES,ANSWER) of a subform on the page.
>
> Private Sub cmdANSWER_Click()
> Forms!FRMMENU1!FRMANSWERSsubform![CASECODE] = Forms!FRMMENU1!
> [CASECODE]
> Forms!FRMMENU1!FRMANSWERSsubform![STEPDES] = Me![STEPDES]
> Forms!FRMMENU1!FRMANSWERSsubform![ANSWER] = Me![CBOANSWER]
> End Sub
>
>
> After this is done i would like it to automatically advance the
> subform (FRMANSWERSSUBFROM) to the next record so that I can add
> multiple entries into it. Can someone help here?
>
> Also, when the main form loads how do i have the subform startup on a
> NEW record?
>
> Thanks for your help! Gavin
>

Probably the easiest method, if the folks are filling out the subform,
is to set the Cycle property to AllRecodds under the Other tab in the
property sheet. When they hit the last field, it goes to the next
record. But...

I created a form/subform. The subform has the fields A, B, C and an ID
to link to the main form. The subform has the following code.

Option Compare Database
Option Explicit
Dim blnNew As Boolean
Private Sub Form_AfterUpdate()
If blnNew Then DoCmd.GoToRecord acActiveDataObject, , acNewRec
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
blnNew = (Me.NewRecord)
End Sub
Private Sub Form_Current()
Me.A.SetFocus
End Sub

As for opening to a new record, you can use the OnEnter event in the
Main form. Click on the subform in the main form and pull up the
property sheet. Modify the code to suit your needs
Private Sub SubFormName_Enter()
If Not Me.SubformName.Form.NewRecord Then
DoCmd.RunCommand acCmdRecordsGoToNew
End If
End Sub

Re: Create/Advance to next record after entry

am 16.10.2007 20:46:12 von gavm360

thanks salad im going to try this out.