Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Posts
    17

    Unanswered: Passing data from one form to another..

    Hello!

    I'm having trouble passing data from one form to another. The main form is used to keep track of tasks I do at work for other people. It just has a subform with 3 textboxes on it, one for the person's name, one for their assigned computer, and the 3rd for a description of the task itself. I use the form's record navigation buttons a tthe bottom to move through the records. Works wonderful!

    The problem I'm having is when I want to add a new task (the test data I've been using is data I manually entered into the table itself). Here's what I'm trying to do:

    I have a button on the main form (New Task). When I click it, it moves to a new record getting ready for a new task, then it pops up a mini-form with ONLY a list box on it that lists the names of the people I do tasks for. I have it coded to grab the person's name and their computer name when I double-click on their name. (the names go into variables, i.e. strName and strCompName, and it does that just fine). HOWEVER, I can't get those two names to pass over to the main form and populate the username textbox and the computername textbox.

    In summary, I have the data ready to pass somewhere, I just can't get it to go to the main form and populate the textboxes over there. Can someone please enlighten me on this? I think it's a just a line or two of code, but I can't get the syntax to save my life!!

    Code so far:

    lstNewName.BoundColumn = 0
    strNewName = lstNewName.Value
    lstNewName.BoundColumn = 1
    strNewCompName = lstNewName.Column(1)

    'at this point the variables have the data ready to do something with it..

    form!frmMain.form.subFormMain.txtUserName.text = strNewName

    'and ^^ that line errors out, saying 'object required' like it doesn't recognize the form.

    Thanks for any help you guys can give!

  2. #2
    Join Date
    Aug 2003
    Posts
    17
    I see that it may be unclear what I'm tring to accomplish or where my error may be occuring, so I'm attatching the mdb itself in hopes that it may help. I'm so stuck on this and have been searching these and other ofrums for more than 2 weeks now and I'm going crazy, lol!

    To get to the part I'm erroring out on, do the following:

    1. Select a TechID from the combo box at the top.
    2. Click the New button in the subform.
    3. Double-click any name in the pop-up form and the error will occur.

    While it's locked up in debug mode, hover your mouse over the variables and note that the name and computer name have been picked up and are ready to do something with them. I just can't get it to pass that data back to the main form and fill in the Employee Name and Compter Name textboxes.

    TIA for any help!!
    Attached Files Attached Files

  3. #3
    Join Date
    Apr 2003
    Location
    FL
    Posts
    50
    Does this means you want to use values of one form in to another form? Make it simple to understand.

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    form!frmMain.form.subFormMain.txtUserName.text = strNewName

    needs to be:
    Forms!frmMain!subFormMain!txtUserName.value = strNewName

    izy

  5. #5
    Join Date
    Aug 2003
    Posts
    17

    Wahoooo!

    Wahooooo! Thanks so much again Izy! You always come to my rescue! I WILL learn this blasted syntax if it's the last thing in Access I do, lol! You're a great help and super-appreciated!! Thanks again

Posting Permissions

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