473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Opening a form from a combo box

I have a combo box with a list in. I want to be able to click
on one of the values in this combo box, and a form will open. The difficult thing is that i want a different form to open for each value in the combo box. Preferably a macro. Any suggestions on how I might be able to achieve this?

Thanks
Sep 15 '08 #1
2 1492
missinglinq
3,532 Expert 2GB
In all code, where your values in the combobox are

one, two, three, four

and the forms are

Form1, Form2, Form3, Form4

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourComboName_AfterUpdate()
  2.  Select Case YourComboName
  3.  
  4.    Case "one"
  5.     DoCmd.OpenForm "Form1"
  6.    Case "two"
  7.     DoCmd.OpenForm "Form2"
  8.    Case "three"
  9.     DoCmd.OpenForm "Form3"
  10.    Case "four"
  11.     DoCmd.OpenForm "Form4"
  12.  
  13.  End Select
  14. End Sub
Or if you already have macros made to open each form
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourComboName_AfterUpdate()
  2.  Select Case YourComboName
  3.  
  4. Case "one"
  5.     DoCmd.RunMacro "OpenForm1Macro"
  6.    Case "two"
  7.     DoCmd.RunMacro "OpenForm2Macro"
  8.    Case "three"
  9.     DoCmd.RunMacro "OpenForm3Macro"
  10.    Case "four"
  11.     DoCmd.RunMacro "OpenForm4Macro"
  12.  
  13.  End Select
  14. End Sub
You will, of course, have to replace the combobox name, all combobox values and form names with your actual names.

Welcome to Bytes!

Linq ;0)>
Sep 15 '08 #2
In all code, where your values in the combobox are

one, two, three, four

and the forms are

Form1, Form2, Form3, Form4

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourComboName_AfterUpdate()
  2.  Select Case YourComboName
  3.  
  4.    Case "one"
  5.     DoCmd.OpenForm "Form1"
  6.    Case "two"
  7.     DoCmd.OpenForm "Form2"
  8.    Case "three"
  9.     DoCmd.OpenForm "Form3"
  10.    Case "four"
  11.     DoCmd.OpenForm "Form4"
  12.  
  13.  End Select
  14. End Sub
Or if you already have macros made to open each form
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourComboName_AfterUpdate()
  2.  Select Case YourComboName
  3.  
  4. Case "one"
  5.     DoCmd.RunMacro "OpenForm1Macro"
  6.    Case "two"
  7.     DoCmd.RunMacro "OpenForm2Macro"
  8.    Case "three"
  9.     DoCmd.RunMacro "OpenForm3Macro"
  10.    Case "four"
  11.     DoCmd.RunMacro "OpenForm4Macro"
  12.  
  13.  End Select
  14. End Sub
You will, of course, have to replace the combobox name, all combobox values and form names with your actual names.

Welcome to Bytes!

Linq ;0)>
Thanks mate, that worked great!

It's for my A-Level project, so this will impress them a little more.

Thanks for the great advice and welcoming
Sep 15 '08 #3

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

Similar topics

8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
2
by: Aravind | last post by:
Hi folks. I have a combo box with a list of names. I want to be able to click (or press "enter" on) a name, which will open a separate form which shows a group of records that corresponds to...
1
by: Todd | last post by:
My form contains a combo box and the "not in list" event is triggerred when the user enters a value that is not among the values listed in the combo box. I want the user to be able to add a new...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
7
by: sara | last post by:
I have a form where the user selects an item from a list box, and then works on that item. The user chooses an AD, then opens a form to assign departments to the ad. The top of the Depts form has...
3
by: ducky | last post by:
I need help with opening a report when a button is clicked, but I only want to open the report with the Object I have chosen in the combo box. This is what i have so far: 'If 2 is selected open...
4
by: linuskamb | last post by:
I have a problem which is a slight twist on discussions I have seen previously here and elsewhere. I have a form with an input select combo box whose target is an internal static iframe. The form...
1
by: abhishekbrave | last post by:
The code below is opening a calendar on mouse over in the same window. I need the calendar to be opened in new window. Have to fulfill this requirement urgentely so posting the whole code here. I...
11
by: casan.mike | last post by:
Hi all, I have a form called "customer_frm" with many records in it. I would like to have a form that has a combobox listing all the customers, and a button that open the "customers_frm" to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.