Results 1 to 9 of 9
  1. #1
    Jerry is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    10

    automatically open cbo

    From cboBoxA in formA I go to formB. When I close formB I would like to have cboBoxB in formA dropdown automatically. FormA does not close when I go to formB
    I’ve tried this in formA
    Private Sub cboBoxB_GotFocus()
    Me.cboBoxB.Dropdown


    End Sub

    I have searched and tried other solutions but can't get it to work.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What means do you use to get "From cboBoxA in formA I go to formB"?

  3. #3
    Jerry is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    10
    I have cascading cbo's and in the last one, cboBoxA, I select an item that refers to a specific form, formB. There are multible forms to go to depending on what is selected in cboBoxA but I only want formB to dropdown cboBoxB in formA when formB is closed. I have tried working from the OnClose in formB. FormA remains open when I go to formB.

    I use Select Case in the cbo After Update Event Procedure

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Do you open FormB with the acDialog argument?

  5. #5
    Jerry is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    10
    This is how it is opened. It is one "case" out of 13.

    Select Case cboBoxA.Value
    Case "FormB"
    DoCmd.OpenForm "FormB", , , "Pattern = '" & Me.cboPatterns & "'"

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    And if you changed that to:
    DoCmd.OpenForm "FormB", , , "Pattern = '" & Me.cboPatterns & "'", ,acDialog
    Me.cboBoxB.SetFocus
    Me.cboBoxB.Dropdown
    ...FormB would open Modal and the code in FormA would stop until FormB was closed or made invisible.

  7. #7
    Jerry is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    10
    Well it almost worked. When I closed formB I see formA but it is not active. Click anywhere on formA to activate and cboBoxB does have focus but it is not dropdown.

    Also if I have another program running when I close formB I am taken out of Access and into the other program?

  8. #8
    Jerry is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    10
    Ok got to work. The code you suggested worked I just had to split it up and get it in the right spot. Stopping the code until formb closed was correct but setting the focus and dropdown had to be inserted after other events took place. I also had a control button to close formb. When I use the control button focus works but not the dropdown. When I use the X, top right hand corner, it all works fine. The issue of other programs running has been resolved. It only happened when I was trying to find the right spot to insert the code.

    Thank you RuralGuy.

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad we could help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Automatically do... everything?
    By .:SoundWave:. in forum Access
    Replies: 4
    Last Post: 12-11-2010, 07:41 PM
  2. How to Automatically Group
    By SSgtJ in forum Reports
    Replies: 3
    Last Post: 05-17-2010, 12:25 PM
  3. Replies: 2
    Last Post: 02-26-2010, 08:14 AM
  4. Replies: 1
    Last Post: 06-04-2009, 07:43 AM
  5. Have database open automatically
    By Norman Masson in forum Access
    Replies: 6
    Last Post: 01-08-2008, 07:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums