Skip to Content
author's profile photo Former Member
Former Member

Opening specific order doc through code

Hi all,

Sorry to bother, but this one is a bit weird. I'm trying to open a specific order document through vb-code. As there appears to be no other option than through the menu's, I'm trying this code:

sbo_app.ActivateMenuItem (ORDERMENU)

sbo_app.SendKeys ("^F") '<= enter search mode

sbo_app.SendKeys (strValue) 'orderno

sbo_app ("")

The resulting form is indeed the sbo-orders form, in search-mode, but the ordernummer is not entered (it is there in code). The cursor is blinking inside the correct screen-item.

I even tried a 500 milsec pause and a 0-100 doevents loop before sending the orderno.

Any suggestions? Is there a better solution?

Thanks,

Jacques

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2005 at 03:20 PM

    Jacques,

    Are you trying to open Order document, using the DocEntry, from the form which you are created?

    Ajith

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Hamdi Syukriwan

      Thanks Hamdi,

      I was afraid it would have to be something like that.

      I was trying to avoid something like this, because I'm not a fan of variable-use like the 'oLookup', but I guess it will have to do...

      Thank you,

      Jacques

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2005 at 08:19 AM

    Hi Jacques,

    Perhaps you can use this sort of code :

    sbo_app.ActivateMenuItem (ORDERMENU)

    Set vForm = SBOApplication.Forms.GetFormByTypeAndCount(139, 0) <== set vForm as new opened Order Form

    vForm.Mode = fm_FIND_MODE <== enter order form find mode

    Set vEditText = vForm.Items("8").Specific

    vEditText.String = strValue <== Rather than sending Order no with sendkeys, send Order No as String Value to Edit Text Control in Order form

    vForm.Items("1").Click <== Click Find Button

    Arief S

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Arief,

      Problem with that code is that you simply can't retrieve the count needed for your form. If there is only one single order window, the count is 1 according to UI-helpfile (and therefore you could use 139,1), but if the user has several of them open already, you just don't know. (or is there a counter I can read somewhere?)

      That's why Hamdi proposed the form-activate event.

      Thank you for your time!

      Regards,

      Jacques

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.