Professional Web Applications Themes

displaying result from VBA into a control of form - Microsoft Access

hello sir i am performing some operations in a VBA and say i get a result of an operation like-result=740x48i in VBA i want to display this evaluated result obtained in VBA on to a control of a form, how do i do acieve this what command(if it is there) or what method i have to give/use in the VBA that displays the result of an operation/calculation/expression in VBA in a control of a form plz help me waiting for a stimulating response thank you mk sabeel [email]mk_sabeelyahoo.co.in[/email]...

  1. #1

    Default displaying result from VBA into a control of form

    hello sir

    i am performing some operations in a VBA and say i get a
    result of an operation like-result=740x48i in VBA

    i want to display this evaluated result obtained in VBA on
    to a control of a form, how do i do acieve this

    what command(if it is there) or what method i have to
    give/use in the VBA that displays the result of an
    operation/calculation/expression in VBA in a control of a
    form

    plz help me

    waiting for a stimulating response

    thank you
    mk sabeel
    [email]mk_sabeelyahoo.co.in[/email]

    mk sabeel Guest

  2. #2

    Default Re: displaying result from VBA into a control of form

    On Tue, 22 Jul 2003 07:24:39 -0700, "mk sabeel"
    <mk_sabeelyahoo.co.in> wrote:
    >i am performing some operations in a VBA and say i get a
    >result of an operation like-result=740x48i in VBA
    >
    >i want to display this evaluated result obtained in VBA on
    >to a control of a form, how do i do acieve this
    If you have a VBA function (it must be a Function, not a Sub) simply
    set the Control Source property of the form control to

    =MyFunction(<parameters>)

    In the Function you would have code like

    Public Function MyFunction(thisparameter, thatparameter) As String
    <your code here>
    MyFunction = <some value>
    End Function

    John W. Vinson[MVP]
    Come for live chats every Tuesday and Thursday
    [url]http://go.compuserve.com/msdevapps?loc=us&access=public[/url]
    John Vinson Guest

  3. #3

    Default Re: displaying result from VBA into a control of form

    hello sir,
    thanks for your feedback in advance again

    i tried the method of assigning the function name to the
    controlsource property but it is not working

    i have written a function to do the evaluation but i dont
    know how to go abt where to write it,displaying it or
    should i write in the modules-type of the database window.
    My code is ready but i just dont know where can i write
    the code and how to display it.

    also sir i want to display the result of an operation in a
    way wherein i dont have to use the controlsource property
    as that feild`s controlsource in form is assigned to a
    feild in a table so that when i get a evaluated value in
    feild of the form it gets saved in the table whose feild
    (table`s) is assigned to the controlsource property of
    that feild in the form.
    Ideally i would like it to be that when i open the form
    the value should have been evaluated and placed in that
    particular feild of the form (without using controlsource
    property) and the result of that feild gets saved in the
    respective feild in the table

    plz help me

    thank you for being so patient
    waiting for a stimulating response
    mk sabeel
    [email]mk_sabeelyahoo.co.in[/email]

    >-----Original Message-----
    >On Tue, 22 Jul 2003 07:24:39 -0700, "mk sabeel"
    ><mk_sabeelyahoo.co.in> wrote:
    >
    >>i am performing some operations in a VBA and say i get a
    >>result of an operation like-result=740x48i in VBA
    >>
    >>i want to display this evaluated result obtained in VBA
    on
    >>to a control of a form, how do i do acieve this
    >
    >If you have a VBA function (it must be a Function, not a
    Sub) simply
    >set the Control Source property of the form control to
    >
    >=MyFunction(<parameters>)
    >
    >In the Function you would have code like
    >
    >Public Function MyFunction(thisparameter, thatparameter)
    As String
    ><your code here>
    >MyFunction = <some value>
    >End Function
    >
    > John W. Vinson[MVP]
    > Come for live chats every Tuesday and Thursday
    >[url]http://go.compuserve.com/msdevapps?loc=us&access=public[/url]
    >.
    >
    mk sabeel Guest

  4. #4

    Default Re: displaying result from VBA into a control of form

    On Wed, 23 Jul 2003 00:00:56 -0700, "mk sabeel"
    <mk_sabeelyahoo.co.in> wrote:
    >hello sir,
    >thanks for your feedback in advance again
    >
    >i tried the method of assigning the function name to the
    >controlsource property but it is not working
    What SPECIFICALLY did you do? What is the actual text in the control
    source? In what way is it "not working"?
    >i have written a function to do the evaluation but i dont
    >know how to go abt where to write it,displaying it or
    >should i write in the modules-type of the database window.
    >My code is ready but i just dont know where can i write
    >the code and how to display it.
    I do not understand. You have written a function but you don't know
    where to write it!?

    It should be in a Module; the name of the module must be different
    than the name of the function. For instance you might have a Module
    named basUtilities containing

    Public Function MyFunc(parm1 As Integer, Parm2 As String) As String
    <various code>
    MyFunc = <the desired output>
    End Function

    and then either set the Control Source of a form or report control to

    =MyFunc(SomeIntegerField, SomeStringField)

    or include as a calculated field in a Query:

    SomeName: MyFunc(SomeIntegerField, SomeStringField)

    Or, you can call the function from VBA code in your Form (see below).
    >also sir i want to display the result of an operation in a
    >way wherein i dont have to use the controlsource property
    >as that feild`s controlsource in form is assigned to a
    >feild in a table so that when i get a evaluated value in
    >feild of the form it gets saved in the table whose feild
    >(table`s) is assigned to the controlsource property of
    >that feild in the form.'
    >Ideally i would like it to be that when i open the form
    >the value should have been evaluated and placed in that
    >particular feild of the form (without using controlsource
    >property) and the result of that feild gets saved in the
    >respective feild in the table
    >
    >plz help me
    >
    >thank you for being so patient
    >waiting for a stimulating response
    >mk sabeel
    >mk_sabeelyahoo.co.in
    >
    >
    >>-----Original Message-----
    >>On Tue, 22 Jul 2003 07:24:39 -0700, "mk sabeel"
    >><mk_sabeelyahoo.co.in> wrote:
    >>
    >>>i am performing some operations in a VBA and say i get a
    >>>result of an operation like-result=740x48i in VBA
    >>>
    >>>i want to display this evaluated result obtained in VBA
    >on
    >>>to a control of a form, how do i do acieve this
    >>
    >>If you have a VBA function (it must be a Function, not a
    >Sub) simply
    >>set the Control Source property of the form control to
    >>
    >>=MyFunction(<parameters>)
    >>
    >>In the Function you would have code like
    >>
    >>Public Function MyFunction(thisparameter, thatparameter)
    >As String
    >><your code here>
    >>MyFunction = <some value>
    >>End Function
    >>
    >> John W. Vinson[MVP]
    >> Come for live chats every Tuesday and Thursday
    >>[url]http://go.compuserve.com/msdevapps?loc=us&access=public[/url]
    >>.
    >>

    John W. Vinson[MVP]
    Come for live chats every Tuesday and Thursday
    [url]http://go.compuserve.com/msdevapps?loc=us&access=public[/url]
    John Vinson Guest

  5. #5

    Default Re: displaying result from VBA into a control of form

    On Wed, 23 Jul 2003 00:00:56 -0700, "mk sabeel"
    <mk_sabeelyahoo.co.in> wrote:

    Sorry! Previous message was sent incomplete.
    >also sir i want to display the result of an operation in a
    >way wherein i dont have to use the controlsource property
    >as that feild`s controlsource in form is assigned to a
    >feild in a table so that when i get a evaluated value in
    >feild of the form it gets saved in the table whose feild
    >(table`s) is assigned to the controlsource property of
    >that feild in the form.
    This might not be a very good idea.

    Storing data which can be derived accomplishes three things:
    it wastes disk space (cheap, I know); wastes time (a
    multiplication is MUCH faster than a disk read); and most
    important, risks data corruption. If one of the fields which
    makes up your expression changes, your calculated value
    stored on disk is now WRONG.

    Rather than storing it, just store the base data and do the
    calculation in a Query or in the Control Source of a textbox
    on a Form or Report. That way the correct calculated value
    will always be regenerated afresh, correctly.
    >Ideally i would like it to be that when i open the form
    >the value should have been evaluated and placed in that
    >particular feild of the form (without using controlsource
    >property) and the result of that feild gets saved in the
    >respective feild in the table
    Does the function depend on values that exist in a record on the Form?
    If so, when you open the Form, do you want the function evaluated for
    the current record? or as you move from record to record, do you want
    to reevaluate it?


    John W. Vinson[MVP]
    Come for live chats every Tuesday and Thursday
    [url]http://go.compuserve.com/msdevapps?loc=us&access=public[/url]

    John Vinson Guest

  6. #6

    Default Re: displaying result from VBA into a control of form

    hello sir
    thank you for ur response

    i have achieved what i wanted to;how i have done is that i
    have writtenthe function in the module ,the function
    doesnt take any parameters , and then the function is run
    from a macro the result of the function is stored in the
    control of the form by assigning the gotfocus property of
    the control to the control,thereby getting the result from
    the function on to the control of the form.
    the reason why i am storing the data in the table is that,
    i have been assigned the job of running a tool/program
    which gives out features of video streams in a text file
    and i am reading the text file and running a query to
    extract features,and the in the module i am opening the
    query as recordset and performing certain calculations on
    the query records and then storing the result of the
    operations in the table of the database to keep track of
    different features of the video streams.

    and also their is no much worry of data corruption in the
    table i am storing the result as from macro i run a
    command i.e"RunCommand" and it that i use "recordsGotoNew"

    but i thing i will tell u sir that their is abt 10 times i
    have to do such operations by reading the text file,as
    their are 10 feilds in form representing corresponding
    unique feature of the video streams, and it takes lot of
    time to get the complete result in all the 10 feilds of
    the form.
    so it is slow, is their any way that i can reduce the
    speed of the above operation,u know sir what the operation
    is which is 1st linking a text file,then running a
    query,then running a function,all this achieved from a
    macro which is assigned to the activate prperty of the
    form,so that when the form opens everything is
    automatically calculated and put in as a new record.

    sir also one thing is that i use in the macro
    the "transfertext" method and when ever i repeat the
    transfering text procedure,by running the macro again
    access2000 makes an extra copy of the table(with a
    different file name),the table containing the text file
    contents. how do i prevent the making of a new table when
    i run the macro.

    thank you being patient by reading such a long mail.
    waiting for your feedback
    thank you
    sabeel
    [email]mk_sabeelyahoo.co.in[/email]
    >-----Original Message-----
    >On Wed, 23 Jul 2003 00:00:56 -0700, "mk sabeel"
    ><mk_sabeelyahoo.co.in> wrote:
    >
    >Sorry! Previous message was sent incomplete.
    >
    >>also sir i want to display the result of an operation in
    a
    >>way wherein i dont have to use the controlsource
    property
    >>as that feild`s controlsource in form is assigned to a
    >>feild in a table so that when i get a evaluated value
    in
    >>feild of the form it gets saved in the table whose feild
    >>(table`s) is assigned to the controlsource property of
    >>that feild in the form.
    >
    >This might not be a very good idea.
    >
    >Storing data which can be derived accomplishes three
    things:
    >it wastes disk space (cheap, I know); wastes time (a
    >multiplication is MUCH faster than a disk read); and most
    >important, risks data corruption. If one of the fields
    which
    >makes up your expression changes, your calculated value
    >stored on disk is now WRONG.
    >
    >Rather than storing it, just store the base data and do
    the
    >calculation in a Query or in the Control Source of a
    textbox
    >on a Form or Report. That way the correct calculated
    value
    >will always be regenerated afresh, correctly.
    >
    >>Ideally i would like it to be that when i open the form
    >>the value should have been evaluated and placed in that
    >>particular feild of the form (without using
    controlsource
    >>property) and the result of that feild gets saved in the
    >>respective feild in the table
    >
    >Does the function depend on values that exist in a record
    on the Form?
    >If so, when you open the Form, do you want the function
    evaluated for
    >the current record? or as you move from record to record,
    do you want
    >to reevaluate it?
    >
    >
    > John W. Vinson[MVP]
    > Come for live chats every Tuesday and Thursday
    >[url]http://go.compuserve.com/msdevapps?loc=us&access=public[/url]
    >
    >.
    >
    mk sabeel Guest

  7. #7

    Default Re: displaying result from VBA into a control of form

    On Wed, 23 Jul 2003 22:21:00 -0700, "mk sabeel"
    <mk_sabeelyahoo.co.in> wrote:
    >how do i prevent the making of a new table when
    >i run the macro.
    Well... if you're reading the same file ten times, just stop doing
    that!!!

    If you have the data in the table already, you do not need to run
    TransferText again. Simply use the table. You may need one macro for
    the initial reading of the file, and a different macro (run ten times)
    to do the calculations.

    I'm afraid this is getting deeper into the project than I can support
    as an unpaid volunteer... what I see as the next step is rewriting the
    Macro as a VBA Module (which will allow much more flexibility), but
    that's more than I can take on in this newsgroup, I fear.

    John W. Vinson[MVP]
    Come for live chats every Tuesday and Thursday
    [url]http://go.compuserve.com/msdevapps?loc=us&access=public[/url]
    John Vinson Guest

Similar Threads

  1. Result not displaying in Flash
    By Gregory Nelson in forum Coldfusion Flash Integration
    Replies: 5
    Last Post: September 4th, 04:14 AM
  2. problems with displaying the result.cfm page
    By vasoulitsa in forum Coldfusion Database Access
    Replies: 21
    Last Post: September 16th, 10:37 AM
  3. Result XML page not displaying
    By mareal in forum ASP.NET Web Services
    Replies: 0
    Last Post: June 8th, 01:41 PM
  4. displaying query result of 0 as N/A
    By eggwater in forum Macromedia ColdFusion
    Replies: 3
    Last Post: May 10th, 11:34 AM
  5. Replies: 5
    Last Post: August 11th, 02:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139