Link to home
Start Free TrialLog in
Avatar of livvie
livvie

asked on

Simulate record selection

I need to simulate selecting a record on a form on some event (prob after update) to update another forms OnCurrent event . Does this make sense ? it's not very easy to explain.
ASKER CERTIFIED SOLUTION
Avatar of harfang
harfang
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of livvie
livvie

ASKER

harfang you might actually have helped already I think the RunCommand acCmdSelectRecord might be what I am looking for.
I have one form that shows a list of records and a second form that shows the details of these records depending on which one is selected on the first form. I had a problem with the child master relationship that was giving an "you cannot assign a value to this object error " so now the second forms datasource is updated when a selection is made on the first form.
What I am doing now is copying a record and then I want it to be displayed and editable. Copying is fine but unless I go an click on the new record it is the details of the old record that is displayed (as this is the record selected in the first form) so I want to automatically select the new record after it is created.
Avatar of livvie

ASKER

harfang DoCmd.RunCommand acCmdSelectRecord  works but I now need a way to ensure it runs after every copy.
I put it in the OnDirt event and that works for the first time you copy a rec but if you do a second one it never enters the OnDirty event  Any ideas ?
Im not sure about OnDirty. Normally, a record is "dirty" after it has been changed and until it has been either saved or canceled. I do not think that paste-append ever triggers the OnDirty event.
Try AfterInsert, perhaps.

Another idea, can't you select the record just *before* copying it rather that *after* all editing events?

Good Luck.