Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Combo Box problem


Message #1 by IT@g... on Wed, 31 Jul 2002 11:48:08
Is it possible to open a form in Access based on what the user has chosen 
from a combo box listed in another form?

If so, does anyone have any examples as I'm not that good with changing 
the VB code?


Cheers.
Message #2 by "Tim Maher" <tim.maher@s...> on Wed, 31 Jul 2002 11:44:02 +0100
Hi,

Give this a go in your code :

Private Sub List0_AfterUpdate()
  If List0.Value = "1" Then
     DoCmd.OpenForm "frm_1"
  End If
  
  If List0.Value = "4" Then
     DoCmd.OpenForm "frm_2
  End If
   
  If List0.Value = "8" Then
     DoCmd.OpenForm "frm_3"
  End If
  
  If List0.Value = "6" Then
     DoCmd.OpenForm "frn_4"
  End If
  
End Sub

Hope this helps!!!


>>> IT@g... 07/31/02 11:48am >>>
Is it possible to open a form in Access based on what the user has
chosen 
from a combo box listed in another form?

If so, does anyone have any examples as I'm not that good with changing

the VB code?


Cheers.
This e-mail transmission is strictly confidential and intended solely 
for the person or organisation to who it is addressed.  It may contain 
privileged and confidential information and if you are not the 
intended recipient, you must not copy, distribute or take any action 
in reliance on it.  
If you have received this email in error, please notify us as soon as 
possible and delete it.
This e-mail has been scanned using Anti-Virus software, however, 
Swansea NHS Trust accept no responsibility for infection caused by 
any virus received on the recipients system.



Message #3 by Omar Chaudry <OChaudry@b...> on Wed, 31 Jul 2002 11:47:30 +0100
Or use a CASE statement i.e.
Select Case List0.Value
Case is 1
'Open form 1
Case is 2
'Open form 2
.
.
.
End Select

HTH
Omar

-----Original Message-----
From: Tim Maher [mailto:tim.maher@s...] 
Sent: 31 July 2002 11:44
To: Access
Subject: [access] Re: Combo Box problem

Hi,

Give this a go in your code :

Private Sub List0_AfterUpdate()
  If List0.Value = "1" Then
     DoCmd.OpenForm "frm_1"
  End If
  
  If List0.Value = "4" Then
     DoCmd.OpenForm "frm_2
  End If
   
  If List0.Value = "8" Then
     DoCmd.OpenForm "frm_3"
  End If
  
  If List0.Value = "6" Then
     DoCmd.OpenForm "frn_4"
  End If
  
End Sub

Hope this helps!!!


>>> IT@g... 07/31/02 11:48am >>>
Is it possible to open a form in Access based on what the user has
chosen 
from a combo box listed in another form?

If so, does anyone have any examples as I'm not that good with changing

the VB code?


Cheers.
This e-mail transmission is strictly confidential and intended solely 
for the person or organisation to who it is addressed.  It may contain 
privileged and confidential information and if you are not the 
intended recipient, you must not copy, distribute or take any action 
in reliance on it.  
If you have received this email in error, please notify us as soon as 
possible and delete it.
This e-mail has been scanned using Anti-Virus software, however, 
Swansea NHS Trust accept no responsibility for infection caused by 
any virus received on the recipients system.






  DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee.  Access to this
message by anyone else is unauthorised.  If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful.  Please immediately contact the sender if you have received this
message in error. Thank you.


Message #4 by "Gregory Serrano" <SerranoG@m...> on Wed, 31 Jul 2002 13:09:20
<< Is it possible to open a form in Access based on what the user has 
chosen from a combo box listed in another form? >>

So far the two answers I saw opens DIFFERENT forms based on the value of 
the combobox.  This example always opens the SAME form, but it varies the 
form's record source based on the combobox selection.


Private Sub cboItem_AfterUpdate()

   DoCmd.OpenForm frmMyForm, , , "[strItem] = '" & Me.cboItem & "'"
    
End Sub


You need to do some error trapping in case Me.cboItem is null or is equal 
to an empty string "".

Greg
Message #5 by "Lonnie@P... on Wed, 31 Jul 2002 06:54:19 -0700 (PDT)
Yes it is possible. Here is the basic code. Let us know if we need to expound. I am going to assume that the form name will show in
the combo box. I will call your combo box MyComboBoxName If not change the syntax as needed.
 
Select Case MyComboBoxName
Case = "Form1"
DoCmd.OpenForm "Form1"
Case = "Form2"
DoCmd.OpenForm "Form2"
End Select
 
Hope this helps.
 
 IT@g... wrote:Is it possible to open a form in Access based on what the user has chosen 
from a combo box listed in another form?

If so, does anyone have any examples as I'm not that good with changing 
the VB code?


Cheers.

Lonnie Johnson 
ProDev, Builders of MS Access Databases
Check me out ==> http://www.galaxymall.com/software/PRODEV 




---------------------------------
Do You Yahoo!?
Yahoo! Health - Feel better, live better

  Return to Index