How can simulate pressing "New Record" Button via Code

T

tt

Hi!

Has anyone great ideas how I can create new record via code and get focus
into desired textbox in form?
The problem with "New record" button is that I can't define focus to desired
textbox or any other items in the form. After pressing "New Record" button
the user has to click the desired textbox and after that he (or she) can
enter values into it.

Thanks,
TT
 
T

tt

Thanks!

these answers are very helpful.
I solved the problem by adding following code:

function AddNewRecord::OnClick(eventObj)
{
// Add New Record
var objXDoc;
objXDoc = Application.XDocuments.NewFromSolution(XDocument.Solution.URI);
objXDoc = Application.XDocuments(0);
Application.XDocuments.Close(objXDoc);

}

When I want 'New Record', the code opens on new document based on the
currently open one and after that close it.
The focus goes to item which have the smallest positive tab index.

TT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top