Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Working with multiple forms (XP)

    I have been going in circles all morning. I have a screen which if a user does not know the account number, he/she may look up accounts by city or name to obtain it. Currently, when looking up accounts by city, a second form displays, with account information and a radio button, that when selected, is supposed to load the account number from the city form to the initial form.

    The de###### is worthless in this instance. When not in debug mode, and I search by city for an account, and select the one that I want, no account shows on the initial screen. When in debug mode and I go through the same steps, the account shows up on the initial screen. This is with no changes in code. What causes this behavior? <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

    Attached is the Address and City programs. (the Address program maintains the Account and Address information)

    When a form loses focus
    Attached Files Attached Files

  2. #2
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Working with multiple forms (XP)

    Ignore the last line of my post. I forgot to eliminate that thought about form focus. Sorry.

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Working with multiple forms (XP)

    If I understand your situation, it works when you use the de######, but if you don't use the de###### it doesn't work. That sounds like some sort of a timing or race condition that doesn't occur as long as you slow it down and step through the code. As to the code you posted, which specific procedure is the one that is supposed to populate the Account number?
    Wendell

  4. #4
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Working with multiple forms (XP)

    That is correct. Using the de######, the program works as expected. When run without the de######, no account is populated. This is what happens.

    -The Form Load event runs (which calls screen 1 that sets properties of form fields.
    -An account number field appears with a button for City, and a button for Company Name ( there is also an Add, Update, Inquire, and Exit button but they are irrelevent to the question at hand)
    -If the user does not know the account, but knows the city, he/she clicks on the city button which fires the btnCity_Click event. This opens frmCity.
    -frmCity has a query attached to it that prompts the user for a city to search. I am sending frmCity as an attachment (I exported it out of Access as text - if there is a better way to export let me know) using Minneapolis as the search city.
    -The query then populates the city form, and the user pages through the results and clicks on a radio button to select the appropriate account that fires the optSelect_Click event. This is the event that populates a Public field strAccount.
    -frmCity is closed, and focus returns to frmAddressMaster. I believe the Form_Activate event fires.
    -Form_Activate calls Screen1 which populates txtAccountNumber from strAccount if strAccount is not blank.

    - I would put my breakpoint at the IF statement of the optSelect_Click and step through the IF statement, then let the program run. This produced the desired result.

    This brings about another interesting question... What exactly is the scope of the fields from the first form? Even though the first form remains open while frmCity runs, the value of frmCity.txtAccount.Value will not move into frmAddressMaster.txtAccountNumber.Value. The txtAccountNumber.Value remains "". Is this because frmAddressMaster is not the active form and fields therefore cannot be updated?
    Attached Files Attached Files

  5. #5
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Working with multiple forms (XP)

    I decided to rebuild a section of the program dealing with the selection of the city, and the problem seemed to clear up. I think maybe a Microsoft "feature" got me. It was really wierd when the de###### and the program without breakpoints worked differently though. Just glad to get by it!!! Thank you for your time and help!!!
    <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

Posting Permissions

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