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
2 1492
In all code, where your values in the combobox are one, two, three, four
and the forms are Form1, Form2, Form3, Form4 - Private Sub YourComboName_AfterUpdate()
-
Select Case YourComboName
-
-
Case "one"
-
DoCmd.OpenForm "Form1"
-
Case "two"
-
DoCmd.OpenForm "Form2"
-
Case "three"
-
DoCmd.OpenForm "Form3"
-
Case "four"
-
DoCmd.OpenForm "Form4"
-
-
End Select
-
End Sub
Or if you already have macros made to open each form -
Private Sub YourComboName_AfterUpdate()
-
Select Case YourComboName
-
-
Case "one"
-
DoCmd.RunMacro "OpenForm1Macro"
-
Case "two"
-
DoCmd.RunMacro "OpenForm2Macro"
-
Case "three"
-
DoCmd.RunMacro "OpenForm3Macro"
-
Case "four"
-
DoCmd.RunMacro "OpenForm4Macro"
-
-
End Select
-
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)>
In all code, where your values in the combobox are one, two, three, four
and the forms are Form1, Form2, Form3, Form4 - Private Sub YourComboName_AfterUpdate()
-
Select Case YourComboName
-
-
Case "one"
-
DoCmd.OpenForm "Form1"
-
Case "two"
-
DoCmd.OpenForm "Form2"
-
Case "three"
-
DoCmd.OpenForm "Form3"
-
Case "four"
-
DoCmd.OpenForm "Form4"
-
-
End Select
-
End Sub
Or if you already have macros made to open each form -
Private Sub YourComboName_AfterUpdate()
-
Select Case YourComboName
-
-
Case "one"
-
DoCmd.RunMacro "OpenForm1Macro"
-
Case "two"
-
DoCmd.RunMacro "OpenForm2Macro"
-
Case "three"
-
DoCmd.RunMacro "OpenForm3Macro"
-
Case "four"
-
DoCmd.RunMacro "OpenForm4Macro"
-
-
End Select
-
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |