Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 15th, 2006, 12:25 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default Opening Multifroms using combo box

Hi guy,

    Iam having an database with 5 table & its appropiate from and i have created an from with combo box and the source data contain the from names. For that i have created an table which contains the name of the from and it is the source.

    Now what i need is i want to get the from by selecting the from name in the combox and just clicing the combo box..

  Eg. Let us asume From1, From2 , From3 and the command buttom : GO
  If i select the from1 and click GO button then From1 should open it is possible for me to get the above by Open.From Script...

 pls give me the solution..:)



bye
------------------------
pap...
 
Old June 15th, 2006, 12:31 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

I am about to log out for the night, but hopefully this will get you headed in the right direction....

On the On-Click event for the combo box, just do something like...

DoCmd.OpenForm cboComboBox.Text

HTH

Mike

Mike
EchoVue.com
 
Old June 15th, 2006, 01:21 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default


 cboComboBox.Text..?! what text pls explain me briefly....
 thanks'



bye
------------------------
pap...
 
Old June 15th, 2006, 08:19 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

What he means is that the combo box will have the form name displayed, and you take the form name from the combo box when the user clicks the button to open the form.

So if your combo boc was called "cboComboBox" then you would want the value or text displayed in the combo box. That is your form name. So using the DoCmd to open the form, your command would be:

DoCmd.OpenForm cboComboBox.Text

Another way to do this is to declare variables, assign values to the variables, and use the variable to open the form, as Access wizards do. That would be a longer way around like this:

Dim stDocName As String
stDocName = Me.cboComboBox
DoCmd.OpenForm stDocName

Neither of these account for users clicking the button without selecting a form. That would be:

Dim stDocName As String

If IsNull(Me.cboComboBox) Or Me.cboComboBox = "" Then
   MsgBox("Please select a form to open")
   Exit Sub
Else
   stDocName = Me.cboComboBox
End If

DoCmd.OpenForm stDocName

A better solution might be to have a seperate button for each form and just use the button wizard to open the forms.

HTH

mmcdonal
 
Old June 16th, 2006, 05:07 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default

Hi,

   Its donal clearly understandable thank u both of u for ur king support,,
   i got the result..


bye
------------------------
pap...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate a text box from a combo box value dnf999 Access VBA 7 February 6th, 2012 02:24 PM
Combo box to display items from parent combo box Gini Visual Studio 2008 0 June 18th, 2008 12:30 AM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.