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

Case Statement to retreive certain records

I have a table entitled "Parts". In that table I have a field entitled "PartDoc" and four fields entitled "Product1", Product2", "Product3", and Product4". The datatype for these fields is Number (look-up). (the number represents a product)
So each record in the table could look like this.
Expand|Select|Wrap|Line Numbers
  1. PartID         PartDoc              Product1       Product2      Product3    Product4  
  2. 12               P-7824                    1                  5                  7               9
I want to do a case statement something like this.
Expand|Select|Wrap|Line Numbers
  1. Private Sub CmdReturn5_Click()
  2.  
  3.     Select Case ?????????
  4.  
  5.         Case 1
  6.             DoCmd.OpenForm "PARTS", , , "[PRODUCT1]='5'"
  7.         Case 2
  8.             DoCmd.OpenForm "PARTS", , , "[PRODUCT2]='5'"
  9.         Case 3
  10.             DoCmd.OpenForm "PARTS", , , "[PRODUCT3]='5"
  11.         Case 4
  12.             DoCmd.OpenForm "PARTS", , , "[PRODUCT4]='5'"
  13.         Case Else
  14.             MsgBox "NO DOCUMENTS FOUND"
  15. End Select
  16.  
  17. Exit Sub
I don't know if this is the right approach. I am new to this as a couple of you know. And I want to thank them for the help with the combobox. I have it working thanks to thier help.

Hope you can help again. Thanks
Apr 15 '09 #1
2 1304
RuralGuy
375 Expert 256MB
The repeating fields look like a normalization issue to me. You might want to review this article on this site.
Apr 15 '09 #2
NeoPa
32,556 Expert Mod 16PB
Desi, I suggest you :
  1. Add your thanks to the thread where the responses are (Select Case Statement with ComboBox).
  2. Pay some attention to the edit comments by some of your posts. I notice that you've posted before without using the [ CODE ] tags, and these have been fixed with a comment to call your attention to it. Please remember to use them in future.
  3. Try rephrasing your question. You currently request code to do what your code does. Expressed that way we can only assume your code already does it perfectly.
You don't seem to be putting much effort into your posts, and this (wasting people's time) can be considered quite impolite in a place such as this where people volunteer their time for free.
Apr 15 '09 #3

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

Similar topics

26
by: Joe Stevenson | last post by:
Hi all, I skimmed through the docs for Python, and I did not find anything like a case or switch statement. I assume there is one and that I just missed it. Can someone please point me to the...
6
by: Michael | last post by:
I have two tables with a 1-many relationship. I want to write a select statement that looks in the table w/many records and compares it to the records in the primary table to see if there are any...
6
by: Dthmtlgod | last post by:
I have this below. If there are 0 records, I want to do nothing, which it does. I need to perform a task if there is more than one. Case > 1 doesn't work. The most records I would have are 5. ...
4
by: ozburger | last post by:
I am trying to do a select statement with SQL 2000 for all records containing any number of lowercase letters. I have tried the following 2 statements and they both seem to match both lowercase...
1
by: Nothing | last post by:
I have a form that the user types in a last name to search for then clicks a search button. Based on the information I want to open the form using the SQL Where statement that will pattern match...
3
by: jodyblau | last post by:
I'm not certain if it is possible to do this, and if it is I don't know what the syntax would look like. I am currently using a statement like so: Set rs1 = CurrentDb.OpenRecordset("Select *...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
5
by: sam_cit | last post by:
Hi Everyone, I read somewhere that there are some compile time operations behind switch-case, which is why it can work for cases which evaluates to an integer or character and not strings and...
13
by: Satya | last post by:
Hi everyone, This is the first time iam posting excuse me if iam making any mistake. My question is iam using a switch case statement in which i have around 100 case statements to compare. so...
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: 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...
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
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,...

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.