Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2005
    Posts
    55

    Unanswered: Bringing data from one form to another

    Hi is there a way to bring in data from one form to another?

    So for example I have a search form"Search Organization" that allows me to search for an Organization Name and if the name of the organization is found I moved to the next form "Request Data". On this form there is the field called Organization Name and I want the name of the organization that was found on the previous form"Search Organization" to be pulled into the present form "Request Data" in the field name called "Organization Name".

    How can I do this?

    Any help given I will be thankful for.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    to pull from another form
    <mycontrol>.Value = forms!<myformname>!<mycontrolname>

    to push (ie send changes to antoher form
    forms!<myformname>!<mycontrolname> = <mycontrol>.Value

    you should wrap it with an error trapping routine just in case the user doesn't have the 'other' form open


    BTW, anuthing agaoinst using an unbound combo box rather than implmeneting a second form
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2005
    Posts
    55
    Healdem I do not understand how to use what you send for me. Can you guide me along in using what you send? Where do I apply what you send?

    Thanks very much.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you say you use a form to search for an organisation name so in that form, once the user has found the orgnaisation name use
    forms!<frmdestinationformname>!<controlname> = <controlname>


    lets say....
    your original form is called frmCustomer,
    ....... it has a control called tbOrgnisationName
    and your search form is called frmOrgSearch
    ....... it has a listbox which has the list of organsiations called lbOrgName...

    then in the frmOrgSearch you place some code in the lbOrgName's on click event which pushes the new value to the frmCustoemr using somethign similar to:-

    forms!frmCustomer!tbOrgnisationName = lbOrgName

    this will 'push' the value from frmOrgSearch to frmCustomer

    if however you prefer to pull the value you could use a button on the frmCustomer to pull a value from the frmOrgSearch, or pull a value accross when a new record is added

    tbOrgnisationName = forms!frmOrgSearch!lbOrgName

    I still think you would be better off using an unbound or bound combo on frmCustomer to get the organsiation name... its a lot cleaener that messign around with otherforms, having to put in the error trapping if the 'other' form isnt loaded.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Oct 2005
    Posts
    55
    Ok Healdem I know you are trying and I am greatful for the help. But I still not understanding.

    So let me tell you what I am trying to do.

    I have a form called "Search Department" this form allows the user to search for a department as well as add a new department if it is not found. The fields on this form are Name of Department and Department Code

    After searching for a department and it is found or added the user than moves to the next form called "Request Data"

    There are the same fields B]Name of Department [/B]and Department Code on this form along with other fields to do the request.

    I want to be able to pull in the inform,the information entered or found in the "Search Department" form fields B]Name of Department [/B]and Department Code into the in fields in B]Name of Department [/B]and Department Code on the "Request Data" form.

    If you can provide a step by step process I will be more than greatfull.

    Anyone can jump in to help me with this.

    Thanks very very very very very much.
    Last edited by Greenway; 11-10-06 at 11:12.

  6. #6
    Join Date
    Mar 2004
    Location
    UK
    Posts
    82

    hi

    not quite sure i understand your explanation of what you are trying to achieve.

    her goes........

    i guess that say, you have [form1] and when you open [form2] you want some of the data from [form1] in to [form2]?

    you can use [form2]'s on open event in the properties of the form to either runcode, or run a macro.

    if you chose to run macro, try the followins

    setvalue [form2]![field1] (set to) [form1]![field2]

    and repeat this for eachfield, this will only work if both forms are still open
    you could use the final command in the macro to close [form1] once you have the desired data.

    if you use vb code

    try

    the name of the destination field for your text as [text1].text = forms![form1]![text2]
    and repeat this for each field required

    not sure if this will help?

Posting Permissions

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