Why Doesn't the Dropdown sustain? (1 Viewer)

prabha_friend

Prabhakaran Karuppaih
Local time
Tomorrow, 03:57
Joined
Mar 22, 2009
Messages
777
Code:
Private Sub Form_Open(Cancel As Integer)
With Me
    .Recordset.AddNew
End With
End Sub
Code:
Private Sub Spare_GotFocus()
Spare.Dropdown
End Sub

The combo wraps-up after the Open Sub Ends... :banghead:
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:27
Joined
Jul 9, 2003
Messages
16,273
I think I'd use the on load event with the following code:-

Change combo name from Spare to cboSpare...

Me.cboSpare.setfocus
Me.cboSpare.dropdown
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:27
Joined
Jul 9, 2003
Messages
16,273
Delete the on focus code stub.
 

missinglinq

AWF VIP
Local time
Today, 18:27
Joined
Jun 20, 2003
Messages
6,423
This kind of thing does belong in the Form_Load event, as Uncle Gizmo suggested, but if you're trying to get the Combobox to have Focus and dropdown, immediately the Form opens, I'm afraid you're in for a disappointment! I've seen this problem reported for years, on the half-a-dozen Access forums I participate in, have seen many, many approaches tried, and have never seen one that worked! Even if, on opening the Form, you set Focus to another Control, then set it to the Combobox, then drop it down, it still immediately returns to the non-dropped down position...it does drop down (I found this out when testing when my anti-virus software was running, making everything else run slowly) but it immediately rolls back up.

I'd love to see a solution that does work!

Linq ;0)>
 
Last edited:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:27
Joined
Jul 9, 2003
Messages
16,273
I'd love to see a solution that does work!

Linq ;0)>

There is a way but it depends where you open the form from. If you open the form with some sort of menu system or another form which you already have open then do it like this:- See example "Why Doesnt the Dropdown sustain_1.zip"

If you want to use the same technique on the initial form that opens when you open your database then you will need to run the autoX macro and do it like this see example:- Why Doesnt the Dropdown sustain_2.zip
 

Attachments

  • Why Doesnt the Dropdown sustain_1.zip
    26.2 KB · Views: 491
  • Why Doesnt the Dropdown sustain_2.zip
    28.9 KB · Views: 481

missinglinq

AWF VIP
Local time
Today, 18:27
Joined
Jun 20, 2003
Messages
6,423
Too cool for school, Uncle Gizmo! As I said, I've seen this problem for years without a solution being found! I've archived your solution, for the future when I see the problem posted...and will always give you credit, of course!

I'm running v2007, and can't access the Design View for the AutoExec Macro...would you mind posting it here, in case I run across someone who needs to do it that way?

Linq ;0)>
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:27
Joined
Jul 9, 2003
Messages
16,273
I'm running v2007, and can't access the Design View for the AutoExec Macro...would you mind posting it here --- Linq ;0)>

I'm not 100% sure what you are asking me? How do I go about posting a Macro?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:27
Joined
Jul 9, 2003
Messages
16,273
Ah! You want an older version I reckon... I didn't know I could save an *.mdb version.

See attached.
 

Attachments

  • Why Doesnt the Dropdown sustain_3.zip
    24.5 KB · Views: 465

missinglinq

AWF VIP
Local time
Today, 18:27
Joined
Jun 20, 2003
Messages
6,423
I'm not 100% sure what you are asking me? How do I go about posting a Macro?

Usually it's done something like this:

Macro Name: AutoExec

Condition: Conditions, if any

Action: OpenForm

Arguments: Arguments, if any

Ah! You want an older version I reckon... I didn't know I could save an *.mdb version.

With v2007 I can open Design Views for some objects, like Forms, in v2010 or v2013 files, but not Macros.

I never use Embedded Macros, but we see more newbies using them, rather than learning VBA, and web-based apps have to use Macros, of course.

Linq ;0)>
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:27
Joined
Jul 9, 2003
Messages
16,273
I've got it... I see what you mean about posting a macro. My first attempt!

Macro Name: AutoExec

Condition: Conditions, None

Action: RunCode

Arguments: Function Name:- fXXX()

Please Note:-
With a macro, you can only call a function you cannot call a subroutine

So for the sake of clarity; you cannot edit embedded macros even if the file is saved as an *.mdb version?
 

Attachments

  • MacroImage.png
    MacroImage.png
    19 KB · Views: 400

missinglinq

AWF VIP
Local time
Today, 18:27
Joined
Jun 20, 2003
Messages
6,423
I'll add that to the archived file on your hack. As I've said, this problem has been on this and other forums for years, without a solution, and I'm tickled that you have given us one! :)

Linq ;0)>
 

Users who are viewing this thread

Top Bottom