424,066 Members | 2,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,066 IT Pros & Developers. It's quick & easy.

how to open one form from multiple forms using combo box in access 2007

P: 1
i have one main form in which i insert combo box in which i put name of the forms manually. now on selecting any particluar form name from combo box i want to open the form containg that name without having master child relations . pl let me know coding to allow opening of form on the basis of name selected from cobo box value(form Name)with hiding the main form simultiniously
2 Weeks Ago #1
Share this Question
Share on Google+
4 Replies


twinnyfo
Expert Mod 2.5K+
P: 2,780
prabhatjian,

Welcome to Bytes!

Your problem is relatively simple:

Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.OpenForm(FormName:=Me.ComboBoxName)
  2. Me.Visible = False
Hope this hepps.
2 Weeks Ago #2

NeoPa
Expert Mod 15k+
P: 31,170
I think you need a little more than that Twinny :
Expand|Select|Wrap|Line Numbers
  1. Private Sub ComboBoxName_AfterUpdate()
  2.     With Me
  3.         Call DoCmd.OpenForm(FormName:=.ComboBoxName)
  4.         .Visible = False
  5.     End With
  6. End Sub
The sub declaration line is relevant and important in this case I would say.
2 Weeks Ago #3

twinnyfo
Expert Mod 2.5K+
P: 2,780
@NeoPa
True. But I did not want to presume on when OP wanted the code to execute.

Your solution is certainly more elegant. Iím just a bum from the slum!

;-)
2 Weeks Ago #4

NeoPa
Expert Mod 15k+
P: 31,170
I was going by the wording in the OP.
PrabhatJain:
now on selecting any particluar form name from combo box i want to open the form containg that name
I understand it wasn't 100% clear ;-)
2 Weeks Ago #5

Post your reply

Sign in to post your reply or Sign up for a free account.