473,385 Members | 1,546 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,385 software developers and data experts.

selecting one item for each hire

Hello All,

I have a quick query regarding limiting only one of each item to be selected in every single order.
For example from the drop down list of item, only one of each items could be selected so
if item1 is selected this would drop into a listbox, when the next item is to be selected, item 1 should not be allowed to be selected.
For the next order this item should reappear.

I am really stuck on this, any help would be appreciated or an example

Thanks
Feb 19 '08 #1
3 1732
ADezii
8,834 Expert 8TB
Hello All,

I have a quick query regarding limiting only one of each item to be selected in every single order.
For example from the drop down list of item, only one of each items could be selected so
if item1 is selected this would drop into a listbox, when the next item is to be selected, item 1 should not be allowed to be selected.
For the next order this item should reappear.

I am really stuck on this, any help would be appreciated or an example

Thanks
If your goal is to absolutely make sure that an Item in a Drop Down Combo Box con never be selected more than once, then it should never appear as an Option once it has been selected, unless of course, it has been Reset. First a few assumptions:
  1. Combo Box Name is cboItems.
  2. Row Source for cboItems = tblItems.
  3. tblItems consists of the following Fields.
    1. [Item_ID] - {AutoNumber} - [Primary Key]
    2. [Item_Name] - {TEXT}
    3. [Selected] - {Yes/No}
  4. Bound Column = 1 ==> [Item_ID], and it is Hidden.
  5. Once an Item is selected from the Combo Box, its [Selected] Field is set to True, the Row Source of the Combo Box is modified to [Selected] = False, and the Combo Box is Re-queried.
  6. All Items marked as Selected, must be Reset at some point in order to display 'All' Items in the Combo Box.
  7. Any questions, feel free to ask.
Expand|Select|Wrap|Line Numbers
  1. Dim MySQL As String
  2.  
  3. DoCmd.SetWarnings False
  4.   MySQL = "Update tblItems Set [Selected] = True Where [Item_ID] = " & Me![cboItems]
  5.   DoCmd.RunSQL MySQL
  6. DoCmd.SetWarnings True
  7.  
  8. Me![cboItems].RowSource = "SELECT [Item_ID], [Item_Name] FROM [tblItems] Where [Selected] = False;"
  9.  
  10. Me![cboItems].Requery
Expand|Select|Wrap|Line Numbers
  1. 'RESET Code (display 'All' Items)
  2. Me![cboItems].RowSource = "SELECT [Item_ID], [Item_Name] FROM [tblItems];"
  3.  
  4. Me![cboItems].Requery
NOTE: Don't rely too heavily on this solution, although it works quite well. It's just that I threw this together when I was going out the door, and someone else will probably have a better response.
Feb 19 '08 #2
I was hoping for the all the items to remain, but if the same item is selected again a message will appear advising ' that this item has already been selected, something along those lines'. any ideas?

Secondly, just reading through the code you provided, how would you hide a bound column.?

thanks
Feb 19 '08 #3
ADezii
8,834 Expert 8TB
I was hoping for the all the items to remain, but if the same item is selected again a message will appear advising ' that this item has already been selected, something along those lines'. any ideas?

Secondly, just reading through the code you provided, how would you hide a bound column.?

thanks
I was hoping for the all the items to remain, but if the same item is selected again a message will appear advising ' that this item has already been selected, something along those lines'. any ideas?
Expand|Select|Wrap|Line Numbers
  1. Dim MySQL As String
  2.  
  3. 'See if the Item has already been selected
  4. If DLookup("[Selected]", "tblItems", "[Item_ID] = " & Me![cboItems]) = True Then
  5.   MsgBox Me![cboItems].Column(1) & " has already been selected, please make another selection", vbExclamation, "Item Already Selected"
  6. Else
  7.   'Not selected until now, so mark as Selected from this point on
  8.   DoCmd.SetWarnings False
  9.     MySQL = "Update tblItems Set [Selected] = True Where [Item_ID] = " & Me![cboItems]
  10.     DoCmd.RunSQL MySQL
  11.   DoCmd.SetWarnings True
  12. End If
  13. End Sub
Secondly, just reading through the code you provided, how would you hide a bound column.?
By setting its Column Width to 0
Feb 20 '08 #4

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

Similar topics

5
by: Mark | last post by:
Hi - is it possible to pass a comma delimeted list to a javascript function, which will then loop through the list, and check against a listboxs items, and if the value in the list, corresponds to...
3
by: james.dixon | last post by:
Hi I was wondering if anyone else had had this problem before (can't find anything on the web about it). I have three select elements (list boxes - from here on I'll refer to them as 'the...
0
by: Andreas Håkansson | last post by:
I've been using the Muenchian method to group XML data, however I have run into a situation where I am unsure how to solve it. What I need to do is select distinct groups of items. I have an XML...
1
by: Nancy Shelley | last post by:
Hi all: I am building a navigation menu using telerik's rad treeview I am able to build the outer menu but not the children. How do I select the child nodes (item) from within the loop? Any...
2
by: David Anderson | last post by:
I'm working on a Windows app that has a ListView containing a bunch of items. When the user clicks on an item, the app displays the item'd details. The user then has the opportunity to edit these...
2
by: Marc Jennings | last post by:
Hi there, I have been given a rather poor schema for an XML file in the following format : ><item> > <key>ProductCode</key> > <value>1234-5678</value> > <key>Description</key> >...
3
by: larry mckay | last post by:
anyone have the code to select and listview item or row (subitems) after a doubleclick event from a listview. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate...
2
by: Derek Vincent | last post by:
Using Visual Studio.net 2003 to create an aspx web form I am having a problem selecting an item from DropDownListBox with id= ListBoxStudies. I can see the items from the bound database table but...
4
by: darrel | last post by:
I have a DDL list along these lines: item value="1" text="a" item value="2" text="b" item value="3" text="c" item value="2" text="d" item value="2" text="e" item value="1" text="f" item...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.