472,102 Members | 1,037 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

Create/Advance to next record after entry

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

Oct 16 '07 #1
2 4203
ga*****@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
Oct 16 '07 #2
thanks salad im going to try this out.

Oct 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Cassandra | last post: by
3 posts views Thread by Jamie Pittman via AccessMonster.com | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.