Set focus on control after update

exASHacto

Registered User.
Local time
Today, 08:35
Joined
Feb 20, 2012
Messages
25
Hi there,

I have a continuous form populated with a pivot view from SQL. When I enter data in the form I send the data to SQL (ctrl after_update) and then re-populate the form. It works.

When I have entered data in a ctrl - then I have to bookmark the record so I can select it again (find_first). I can "save" the location of the control where I have entered data, but I want to select the location where the user has set focus - which triggered the ctrl after_update.... does it make sense?

My ctrl after_update looks like this:
Code:
    txt_account = Me.Parent.txt_account_id.Value
    txt_cost_center = Me.ActiveControl.Name
    Call update_data_input(Me.ActiveControl.Value, Me.account_id.Value, Me.ActiveControl.Name)
    Me.Undo
    Me.Requery
    With Me.RecordsetClone
        .FindFirst "account_id = " & txt_account
        Me.Bookmark = .Bookmark
    End With
    Controls(txt_cost_center).SetFocus

thanks!
Anders
 
I usually use

DoCmd.GotoControl "controlidnamehere"
 
I think I have to re-write my problem.

The input form
Rows: Accounts
Columns: Cost centre
Type: Continuous form with pivot-view from SQL (not updatable)

The workflow
1. The user updates a value for one account for one cost center
2*. The user selects something else (e.g. another account, another cost center or leaves form)

The technic
1. I log the account, cost center and value after_update
2. Sends the informations to the SQL database
3. Undo the user input
4. Re-populate the form with the pivot-view including the new data
5. Requery
6. Set focus on the "old" account and cost centre.

QUESTION
How do I select the "thing" the user has selected in "The Workflow 2*."??
Should I use another event?

Thanks
 
if you can reposition the cursor to the active row, then setting the focus to the right control is trivial

effiectively you end up with

save the active control name
your function to return to the correct row
controls("lastcontrol").setfocus
 
exel formula to access query

I've never used a formula to access Exel, please help her attached Exel existing files in the input formula to access query

thank you

ira borneo
 

Attachments

if you can reposition the cursor to the active row, then setting the focus to the right control is trivial

effiectively you end up with

save the active control name
your function to return to the correct row
controls("lastcontrol").setfocus

I'm doing exactly that.

Maybe I'm using the wrong event?! I want to log the new position not the old.
 
How can I "catch" the new "activecontrol" after/before an update?
 

Users who are viewing this thread

Back
Top Bottom