473,396 Members | 1,770 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.

Question on using cases, and possibily string comparison...

This should be an easy question. My code below works, but I'm realising that using a seperate case for each "cabtype" will end up making my code very bulky, and right now its over 64k, making it too big. This code checks [cbo_cabtype] from a form in my database, and depending on the cabtype it will execute different code.

frmcables.[cbo_cabtype].SetFocus
Select Case frmcables.[cbo_cabtype]
Case "2C1"
With frmcables
'
'
' My code
'
'
End With

Basically, I would like to check if the "cabtype" I want is one of many different ones, instead of just one (2C1 in the above code). So I'd like to have some code similar to the code below. Keep in mind that this code does not work.

frmcables.[cbo_cabtype].SetFocus
Select Case frmcables.[cbo_cabtype]
Case "2C1" or "2C2" or "2C3"
With frmcables
'
'
' My code
'
'
End With

When I try this code I get runtime error 13 (type mismatch). Any way that I can make this code work? I'd just make a whole bunch of different cases, one for each "cabtype", but doing this has made my code too large.

Any suggestions?

Thanks

Ian
Aug 6 '08 #1
3 1437
missinglinq
3,532 Expert 2GB
Just place a comma between then:

Case "2C1", "2C2", "2C3"


You might want to take a look at this post. It presents a number of ways for working with Cases:

Understanding the Select Case Statement

Linq ;0)>
Aug 6 '08 #2
NeoPa
32,556 Expert Mod 16PB
Nice link Linq ;)

That should answer all the questions, but if you need more help feel free to post.

Welcome to Bytes!
Aug 6 '08 #3
Thanks!!! Exactly what I was looking for.
Aug 7 '08 #4

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

Similar topics

11
by: kazack | last post by:
I am under the the impression that a variable is what is stored in a memory address and a pointer is the memory address of the variable? I was looking to use a function that does not return a...
3
by: Vishal Ladha | last post by:
Hi ! I have been experimenting with char * for a while now. I have two pieces of code : Code1 : ===== char *ptr = "hello";
51
by: Alan | last post by:
hi all, I want to define a constant length string, say 4 then in a function at some time, I want to set the string to a constant value, say a below is my code but it fails what is the correct...
5
by: allison | last post by:
Can someone point me to a guide on when to use static methods versus instance methods in a class? For instance, is it bad design to have a static method that creates an instance of another class? ...
3
by: Tdw | last post by:
In C#, you can use the string data type to hold a series of characters. The string can be compared to another string using the == operator in the same way that you compare numeric or character...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
9
by: Steven | last post by:
Hello, I have a question about strcmp(). I have four words, who need to be compared if it were two strings. I tried adding the comparison values like '(strcmp(w1, w2) + strcmp(w3, w4))', where...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
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
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
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...

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.