473,404 Members | 2,179 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,404 software developers and data experts.

dropdown list box - control order

I am trying to add the ability for a user to change the order in which
the elements are listed in a dropdown list box. Before I added the
ListID field the dropdown list box order was controlled using the
MotorhomeID. The problem I am having is that I don't know the best
method for allowing people to make the ListID changes easily.

Database: MS Access 2000

Table: Default-Motorhome
Fields:
MotorhomeID (autonumber)
MotorhomeName (text)
ListID (number)

I want the user to be able to change the ListID from a form.

Example: Motorhome A
ListID=1

Motorhome C
ListID=2

Motorhome B
ListID=3
The ListID controls what number the record is displayed as in a list
dropdown box. Notice that Motorhome C is listed above Motorhome B.
Nov 12 '05 #1
3 7057
What would be a natural order for them? That is what you ought to use. If
"Motorhome A" actually refers to Manufacturer and Model, then that would be
reasonable; if it refers to Mr. Smith's Motorhome, it _might_ still be
preferrable.

Larry Linson
Microsoft Access MVP

"Charles" <ch*****@charlesgreen.org> wrote in message
news:3f**************************@posting.google.c om...
I am trying to add the ability for a user to change the order in which
the elements are listed in a dropdown list box. Before I added the
ListID field the dropdown list box order was controlled using the
MotorhomeID. The problem I am having is that I don't know the best
method for allowing people to make the ListID changes easily.

Database: MS Access 2000

Table: Default-Motorhome
Fields:
MotorhomeID (autonumber)
MotorhomeName (text)
ListID (number)

I want the user to be able to change the ListID from a form.

Example: Motorhome A
ListID=1

Motorhome C
ListID=2

Motorhome B
ListID=3
The ListID controls what number the record is displayed as in a list
dropdown box. Notice that Motorhome C is listed above Motorhome B.

Nov 12 '05 #2
Larry,
Thank you for the responce. Here is more detail.

My customer uses access to create a RV Rental Contract. To simplify
the scenario I have 2 tables, 2 forms, and 1 report.

Tables: Customer (store customer data and selected RV)
RV (stores RV data)

Forms: Contact (used to enter customer and select RV from combo box)
RV (used to enter available RVs)

Report: Contact (Rental Agreement)

Table: Customer
----------------------
CustID (autonumber) – customer ID – primary key
Name (text) – customer name
RVID (number) – RV ID - foreign key

Table: RV
----------------------
RVID (autonumber) – RV ID – Primary Key
RVName (text) – RV Name
ListID (number) – I added this to keep track of the desired order in
the in the combo box.
Service (Yes/No) – Used to signify what RVs are in service and those
out of service.

My customer currently has the ability to manage what RVs are listed in
the combo box by having the "Service" field checked or unchecked.
Currently, the user selects the desired RV from a combo box.

What I am trying to do is to give them the ability to control the
order that they are listed in. The source data for the combo box is
stored in the RV table. For instance:

Table: RV
RVID | RVName | ListID |Service
---------------------------------------------
1 | Motorhome A | 1 |Yes
2 | Motorhome B | 2 |Yes
3 | Motorhome C | 3 |Yes

Combo Box would list:
Motorhome A
Motorhome B
Motorhome C

However if I change the ListID of Motorhome B & C

RVID | RVName | ListID |Service
---------------------------------------------
1 | Motorhome A | 1 |Yes
2 | Motorhome B | 3 |Yes
3 | Motorhome C | 2 |Yes

I want the combo box to list them like this.
Combo Box would list:
Motorhome A
Motorhome C
Motorhome B

The problem: How do I create a form that will allow the user the
ability to change the ListID easily without giving it the same value
as one of the records.

----------------------------------------------
What would be a natural order for them? That is what you ought to use. If"Motorhome A" actually refers to Manufacturer and Model, then that would bereasonable; if it refers to Mr. Smith's Motorhome, it _might_ still be preferable.
Larry Linson
Microsoft Access MVP "Charles" <ch*****@charlesgreen.org> wrote in message
news:3f**************************@posting.google. com...
I am trying to add the ability for a user to change the order in which the elements are listed in a dropdown list box. Before I added the
ListID field the dropdown list box order was controlled using the
MotorhomeID. The problem I am having is that I don't know the best
method for allowing people to make the ListID changes easily.

.. Database: MS Access 2000

Table: Default-Motorhome
Fields:
MotorhomeID (autonumber)
MotorhomeName (text)
ListID (number)

I want the user to be able to change the ListID from a form.

Example: Motorhome A
ListID=1

Motorhome C
ListID=2

Motorhome B
ListID=3
The ListID controls what number the record is displayed as in a list dropdown box. Notice that Motorhome C is listed above Motorhome B.

Nov 12 '05 #3
Put an option group (frame control) on the form, with one option button for
each of the sort choices, and make the default value equal to the value of
the option which is in the combo's RowSource.

In the AfterUpdate event of the frame control, code sql for the combo's
RowSource, with a different order by clause for each option, and then
requery the combo (requery may or may not be necessary).

EG, aircode,

Private Sub fraSort_Afterupdate
Dim str as string
str= "Select field1, field2, field3 from table order by "
select case fraSort
case 1
str = str & "field1"
case 2
str = str & "field2"
case 3
str = str & "field3"
end select

combo1.rowsource = str
combo1.requery
End Sub

Richard Bernstein

ch*****@charlesgreen.org (Charles) wrote in
news:3f**************************@posting.google.c om:
The problem: How do I create a form that will allow the user the
ability to change the ListID easily without giving it the same value
as one of the records.


Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JLOI | last post by:
Hi All, I am trying to implement a dropdown-button control in C# which provides a list of actions. Many Microsoft applicaitons use this kind of control. One example is in the V.S IDE's file...
0
by: Philip Townsend | last post by:
I have a datagrid that contains a dropdown list that is part of an EditItemTemplate. I need to run some code when the dropdown list builds in order to preselect an item in the list. Preselecting...
1
by: Philip Townsend | last post by:
I have a datagrid that contains a dropdown list that is part of an EditItemTemplate. I need to run some code when the dropdown list builds in order to preselect an item in the list. Preselecting...
2
by: Irishmaninusa | last post by:
Hello Everyone, I am populating a dropdown control from a database where the data is datetime values. In my stored procedure I am ordering them by where the most recent is at the top and the...
4
by: Dabbler | last post by:
I have two tables I'm editing in a Gridview. The VANS table contains a key to the other LESSOR table. I would like to use a dropdown list to select the LessorId value while displaying the Lessor...
2
by: Spartaco | last post by:
I have a dropdown control into a page and a gridview, both are associated to two SqlDataSource controls, one of them is used to fill the DropDownControl, that is meant to be a filter over the query...
5
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My...
2
by: Sin Jeong-hun | last post by:
If I create a button like control, then I simply can draw button-like lines on my User Control's surface by getting its Graphics g. If I draw outside of the control's ClientRectangle (for example,...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.