help with combo box

Bigthinkor

New member
Local time
Today, 00:25
Joined
Jan 12, 2011
Messages
8
hello everyone,

I am new to the forum and I would appreciate any help. I am using Access 2010 and I need to create a combo box that lists all the forms in my database. I need to be able to select a form from a drop-down list and it opens up the selected form.I've tried

:mad: SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") AND

(MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;


Private Sub FormOpenCombo_AfterUpdate()
stDocName = Me.FormOpenCombo
DoCmd.OpenForm stDocName
End Sub

to run this but no success. The cold is outdated


any help with the coding or strings would be greatly appreciated
 
Noob answer: Make a lookup table with all the form names in it...
 
Where did you put that SELECT statement??

It should go into the ROW SOURCE property of the combo box.

You don't need code.
 
I put the select statement in the row source. I am thinking that maybe this is an incompatibility problem because of The Version of Access that I'm running is 2010
 
No compatibility issues there.

So the combo box is showing the list of forms but when you select from the list nothing happens? Or it throws an error?
 
Use this:

SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') AND (MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;
 
No compatibility issues there.

So the combo box is showing the list of forms but when you select from the list nothing happens? Or it throws an error?
Rick, I like to say thank you for your reply but I am still face with the same problem. I cannot get the combo box to open the forms based on the selection from my list, your ideas are greatly appreciate.
 
Use this:

SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') AND (MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;
Rick, I like to say thank you for your reply but I am still face with the same problem. I cannot get the combo box to open the forms based on the selection from my list, your ideas are greatly appreciate.
 
I can't get this to fail...
SELECT Name FROM MsysObjects WHERE Type = -32768 ORDER BY Name;
Code:
Private Sub Combo22_AfterUpdate()
  DoCmd.OpenForm Me.Combo22
End Sub
Maybe your combo has mutiple columns or the bound column <> 1??? Maybe create a new one, set the rowsource and rewrite the AfterUpdate handler
 
Noob answer: Make a lookup table with all the form names in it...

That's pretty much what MSysObjects is.

...and for those not in the know, if you go to your Tools menu Options sub menu and check System Objects on the View tab, you will find that a whole lot of previously hidden tables will appear with ghosted table icons next to them :)
 
Last edited:
As an addendum to lagbolt's suggestion try the following code in your button and see what value it returns;
Code:
MsgBox Me.FormOpenCombo
 
Hmmm... I would doubt that it's returning anything else than the form name but it's still worth a try.

My suspicion is that [Event Procedure] is not showing in the After Update property or your database has not been Trusted so code is not allowed to run.
 
:D:D:Dlagbolt thank you very much. It works perfectly also I would like to thank everyone for their feedback and suggestions. This is this is a great forum
 
Last edited:

Users who are viewing this thread

Back
Top Bottom