[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

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.
0
livvie
Asked:
livvie
  • 2
  • 2
1 Solution
 
harfangCommented:
No, it doesn't :)

Just the title, "simulate record selection" makes one think of the "Edit / Select Record" menu command, which you can "simulate" (execute through code) with "RunCommand acCmdSelectRecord"

The "explanation" however seems to relate to form navigation. Do you want to move to a certain record in a second form when editing is done in the first?

Please expand, I'm sure we will be able to help.

Cheers!
0
 
livvieAuthor Commented:
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.
0
 
livvieAuthor Commented:
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 ?
0
 
harfangCommented:
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.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now