Tab control & go to new record

RichO

Registered Yoozer
Local time
Today, 08:10
Joined
Jan 14, 2004
Messages
1,036
I have a form with a tab control. Within one of the tabs is a continuous form. When this tab is selected I want this form to go to a new record for data entry.

In the continuous form's On Activate event I have

DoCmd.RunCommand acCmdRecordsGoToNew

This works fine when opening the form on its own but when it is inside a tab control the event does not fire when the tab is clicked.

Any suggestions on how I can force a new record on this form when the tab is clicked? I tried using code in the tab control's On Change event but I'm not sure how to code it to call the form's Activate event.

Code:
[B][COLOR="Blue"]If MyTabs=2 Then
      Me.frmAccountLedger.(code to force a new record or fire Activate event)
End If[/COLOR][/B]

Thanks
 
I tried using this code:

Code:
If myTabs = 2 Then
   Me.frmAccountEntries.Form.DataEntry=True
   Me.frmAccountEntries.Requery
End If

But it has no effect.

I posted a sample DB (Access 2000) with a form in which the code does have an effect on the form but not the desired effect. When you click the Page 2 tab, the 3 existing records in the form/table do not appear in the form and the cursor does not set focus to the new record.

It looks like setting DataEntry to True causes the existing records in the form/table not to display but I do need the existing records to be visible as well.

Thanks for your help.
 

Attachments

Using a suggestion in that thread I was able to set focus to the first control in the form for data entry, the problem is that when you set a form's data entry property to true, it no longer shows the other records in the table, only the new records that you enter.

None of the form's events fire when the form is inside a tab and it seems like there is no way to force one of those events to fire when the tab/form gets the focus.

I thought it would be simple but it looks like it might not even be possible.

Thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom