Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Passing arguements

Discussion in 'Information Technology' started by DaBartman, Jul 28, 2006.

  1. DaBartman

    DaBartman
    Expand Collapse
    Guest

    I need some help in passing numeric data from a textbox and textual data from
    another textbox on thr same form to another form when I open the new form. I
    plan on using DoCmd.OpenForm "FormName", That's as far as I get. Have spent
    90 minutes reeading help files and am just as lost as when I started. Can
    this even be done? Hope I explained what I am trying to do well enough to get
    some feedback.
    Bart
     
  2. Loading...


  3. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    Assuming the following object names in my example below:

    First form: Form1
    Textbox on first form: txtbox1
    Second form: Form2
    Textbox on second form: txtbox8

    Sample code (in first form's module:)

    strForm = "Form2"
    Docmd.OpenForm strForm
    Forms(strForm)!txtbox8 = Me.txtbox1

    Sample code (in any module:)

    strForm1 = "Form1"
    strForm2 = "Form2"
    Docmd.OpenForm strForm2
    Forms(strForm2)!txtbox8 = Forms(strForm1)!txtbox1

    Note: the data type (text or numeric) does not affect the syntax in this
    case.

    HTH,
    Nikos

    DaBartman wrote:
    > I need some help in passing numeric data from a textbox and textual data from
    > another textbox on thr same form to another form when I open the new form. I
    > plan on using DoCmd.OpenForm "FormName", That's as far as I get. Have spent
    > 90 minutes reeading help files and am just as lost as when I started. Can
    > this even be done? Hope I explained what I am trying to do well enough to get
    > some feedback.
    > Bart
     
  4. DaBartman

    DaBartman
    Expand Collapse
    Guest

    Nikos, thank for your help! The first parts works perfectly. The problem is
    I mistakenly gave you incomplete information. The second bit of data from the
    tectbox you refered to as txtbox8 is not on the same form as the first one!
    The second textbox is located in a subform within the origional form. My
    fault, I just didn't notice where the second text was located. Have tried
    several possible solutions based on the second part of your original
    solution. Alas, to no avail:(. A bit more help would be appreciated.
    Bart

    "Nikos Yannacopoulos" wrote:

    > Assuming the following object names in my example below:
    >
    > First form: Form1
    > Textbox on first form: txtbox1
    > Second form: Form2
    > Textbox on second form: txtbox8
    >
    > Sample code (in first form's module:)
    >
    > strForm = "Form2"
    > Docmd.OpenForm strForm
    > Forms(strForm)!txtbox8 = Me.txtbox1
    >
    > Sample code (in any module:)
    >
    > strForm1 = "Form1"
    > strForm2 = "Form2"
    > Docmd.OpenForm strForm2
    > Forms(strForm2)!txtbox8 = Forms(strForm1)!txtbox1
    >
    > Note: the data type (text or numeric) does not affect the syntax in this
    > case.
    >
    > HTH,
    > Nikos
    >
    > DaBartman wrote:
    > > I need some help in passing numeric data from a textbox and textual data from
    > > another textbox on thr same form to another form when I open the new form. I
    > > plan on using DoCmd.OpenForm "FormName", That's as far as I get. Have spent
    > > 90 minutes reeading help files and am just as lost as when I started. Can
    > > this even be done? Hope I explained what I am trying to do well enough to get
    > > some feedback.
    > > Bart

    >
     
  5. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    Bart,

    Assuming the subform is named SubForm4, the example code would be
    modified to:

    strForm = "Form2"
    strSubForm = "SubForm4"
    Docmd.OpenForm strForm
    Forms(strForm).controls(strSubForm).Form.Controls("txtbox8)" = Me.txtbox1

    (watch out for wrapping in your newsreader, the last expression is all
    in one line!)

    HTH,
    Nikos

    DaBartman wrote:
    > Nikos, thank for your help! The first parts works perfectly. The problem is
    > I mistakenly gave you incomplete information. The second bit of data from the
    > tectbox you refered to as txtbox8 is not on the same form as the first one!
    > The second textbox is located in a subform within the origional form. My
    > fault, I just didn't notice where the second text was located. Have tried
    > several possible solutions based on the second part of your original
    > solution. Alas, to no avail:(. A bit more help would be appreciated.
    > Bart
    >
    > "Nikos Yannacopoulos" wrote:
    >
    >> Assuming the following object names in my example below:
    >>
    >> First form: Form1
    >> Textbox on first form: txtbox1
    >> Second form: Form2
    >> Textbox on second form: txtbox8
    >>
    >> Sample code (in first form's module:)
    >>
    >> strForm = "Form2"
    >> Docmd.OpenForm strForm
    >> Forms(strForm)!txtbox8 = Me.txtbox1
    >>
    >> Sample code (in any module:)
    >>
    >> strForm1 = "Form1"
    >> strForm2 = "Form2"
    >> Docmd.OpenForm strForm2
    >> Forms(strForm2)!txtbox8 = Forms(strForm1)!txtbox1
    >>
    >> Note: the data type (text or numeric) does not affect the syntax in this
    >> case.
    >>
    >> HTH,
    >> Nikos
    >>
    >> DaBartman wrote:
    >>> I need some help in passing numeric data from a textbox and textual data from
    >>> another textbox on thr same form to another form when I open the new form. I
    >>> plan on using DoCmd.OpenForm "FormName", That's as far as I get. Have spent
    >>> 90 minutes reeading help files and am just as lost as when I started. Can
    >>> this even be done? Hope I explained what I am trying to do well enough to get
    >>> some feedback.
    >>> Bart
     

Share This Page