Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to get an event to fire in a tab Control in ACCESS 2007

Status
Not open for further replies.

TinaS

Programmer
Sep 18, 2002
35
US
hello all!

My issue is this:
I have a main form frm_Tasks with a suform frm_TasksTracking.

Because this will be used heavily, I want to NOT force the users to click a button or 'goto' a new record, I want to the New record on the subform to auto set when the form loads, and when navigating between records on the main form.

Currently the subform is in a tab control on the main form. I tried a number of ways and put code in a number of events - the code DOES work, but I need help on getting the tab control/subform to set the new record - without forcing it to 'get focus' first.(if possible)

here is the code:
Public Sub NewTaskRec()
If TabCtl52.Value = 1 Then
Forms!frm_Tasks!frm_TaskTracking.SetFocus

DoCmd.GoToRecord , , acNewRec
End If

End Sub


I have this in a number of areas, and it works, but if the tab control is NOT on the subform, the code won't fire. If I take out the 'if' condition, and just have the code set the focus, make the change to the subform, then go back to the original tab, it looks horrible on the screen - i.e., you can see it flashing to the tab control with the subform and flashing back


How can I get the subform on another control to 'go to a new record' every time the main record changes? maybe there is an easier master way to do this - but everything I have tried fails. Everything requires me to set the focus on this control, and if it's not there to begin with there is this flashy mess on the screen as it goes through the motions.

Please help!

Thank you!

Tina
 
Have you tried using:
Me.Painting = False '-- Stop screen update
Me.Painting = True '-- Start screen update

(RG for short) aka Allan Bunch MS Access MVP acXP, ac07 - winXP Pro, Win7 Pro
Please respond to this forum so all may benefit
 
Thank you for the reply - i did try this but it wasn't giving me the results I wanted. For the time being, I am bypassing it and hoping the users won't mind getting taken to the tab control that was being refreshed.

i.e., instead of it flipping to that control and back, I am just going to that control and letting the user decide if they need to go back to the main tab... we will see..

If it ends up being an ongoing issue I will have to revist and try again.

Thank you again for the reply!
 
Here's a couple things that come to mind although I didn't check them:

You could set the subform to add new records only.

You could set the recordsource of the subform to autonumber (if you have one)descending.

One of those might work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top