Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page