I want to use select case in a loop as under: -
Dim i As Integer
-
i = 1
-
While i < 6
-
Select Case Field1
-
Case "Title"
-
strFld(i) = "([Title] & ': ' & [Subtitle])"
-
Case "Author"
-
strFld(i) = "([AUTHOR] & ', ' & [SUBAUTHOR])"
-
Case "Subject"
-
strFld(i) = "Subject"
-
Case "Publisher"
-
strFld(i) = "Publisher"
-
Case "Year of Publication"
-
strFld(i) = "Year"
-
Case "Call No"
-
strFld(i) = "([DDC_NO] & ' ' & [Auth_MARK])"
-
Case "Acc No"
-
strFld(i) = "ACCNO"
-
End Select
-
i = i + 1
-
Wend
-
-
can I use the line no 4 code as:
Select Case Field1, Field2, Field3, Field4, Field5
Note: Field(5) is string variable and strFld(5) is also a string variable
4 5681 MMcCarthy 14,534
Recognized Expert Moderator MVP
Try this ... -
Dim i As Integer
-
i = 1
-
While i < 6
-
Select Case "Field" & i
-
Case "Title"
-
strFld(i) = "([Title] & ': ' & [Subtitle])"
-
Case "Author"
-
strFld(i) = "([AUTHOR] & ', ' & [SUBAUTHOR])"
-
Case "Subject"
-
strFld(i) = "Subject"
-
Case "Publisher"
-
strFld(i) = "Publisher"
-
Case "Year of Publication"
-
strFld(i) = "Year"
-
Case "Call No"
-
strFld(i) = "([DDC_NO] & ' ' & [Auth_MARK])"
-
Case "Acc No"
-
strFld(i) = "ACCNO"
-
End Select
-
i = i + 1
-
Wend
-
-
Dear
Thanks for response.
"Select Case "Field" & i" is treated as:
Select "Field1", "Field2".
But i want to use it as variable, not constant. Field1, Field2... are the names of combo boxes on the form.
Values of these combo boxes may differ in all cases
Ata
Try this ... -
Dim i As Integer
-
i = 1
-
While i < 6
-
Select Case "Field" & i
-
Case "Title"
-
strFld(i) = "([Title] & ': ' & [Subtitle])"
-
Case "Author"
-
strFld(i) = "([AUTHOR] & ', ' & [SUBAUTHOR])"
-
Case "Subject"
-
strFld(i) = "Subject"
-
Case "Publisher"
-
strFld(i) = "Publisher"
-
Case "Year of Publication"
-
strFld(i) = "Year"
-
Case "Call No"
-
strFld(i) = "([DDC_NO] & ' ' & [Auth_MARK])"
-
Case "Acc No"
-
strFld(i) = "ACCNO"
-
End Select
-
i = i + 1
-
Wend
-
-
MMcCarthy 14,534
Recognized Expert Moderator MVP
Dear
Thanks for response.
"Select Case "Field" & i" is treated as:
Select "Field1", "Field2".
But i want to use it as variable, not constant. Field1, Field2... are the names of combo boxes on the form.
Values of these combo boxes may differ in all cases
Ata
Ata
I'm totally confused.
Can you explain logically (not with code) exactly what you are trying to do.
Dear mmccarthy
Thanks for response. Sorry I could not make clear question. But the problem has been solved as under with a slight change:
I hope you may easily understand the following code: -
Dim i As Integer
-
Dim cb(5) As ComboBox
-
Set cb(1) = Field1
-
Set cb(2) = Field2
-
Set cb(3) = Field3
-
Set cb(4) = Field4
-
Set cb(5) = Field5
-
-
i = 1
-
While i < 6
-
Select Case cb(i)
-
Case "Title"
-
strFld(i) = "([Title] & ': ' & [Subtitle])"
-
Case "Author"
-
strFld(i) = "([AUTHOR] & ', ' & [SUBAUTHOR])"
-
Case "Subject"
-
strFld(i) = "Subject"
-
Case "Publisher"
-
strFld(i) = "Publisher"
-
Case "Year of Publication"
-
strFld(i) = "Year"
-
Case "Call No"
-
strFld(i) = "([DDC_NO] & ' ' & [Auth_MARK])"
-
Case "Acc No"
-
strFld(i) = "ACCNO"
-
End Select
-
i = i + 1
-
Wend
-
-
Ata
I'm totally confused.
Can you explain logically (not with code) exactly what you are trying to do.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Mohammed Mazid |
last post by:
Hi folks!
Can anyone please help me with this?
I am developing a Quiz program but I am stuck with "multiple answers".
Basically I need some sort of code that would select multiple answers
using check boxes.
For example, a question such as
|
by: Ed L. |
last post by:
I think I'm seeing table-level lock contention in the following function
when I have many different concurrent callers, each with mutually distinct
values for $1. Is there a way to reimplement this function using
select-for-update (or equivalent) in order to get a row-level lock (and
thus less contention) while maintaining the function interface? The docs
seem to suggest so, but it's not clear how to return the SETOF queued_item
and also...
|
by: mabond |
last post by:
Hi
Is it possible to compare a vaule for a select case statement using a
wildcard.
e.g. somthing like
Select case myValue
case like "*ing"
end select
|
by: Ian Richardson |
last post by:
Hi,
The function I've put together below is a rough idea to extend a SELECT
list, starting from:
<body>
<form name="bambam">
<select id="fred">
<option value="1">1</option>
<option value="2">2</option>
|
by: MP |
last post by:
vb6,ado,mdb,win2k
i pass the sql string to the .Execute method on the open connection to
Table_Name(const) db table
fwiw
(the connection opened via class wrapper:)
msConnString = "Data Source=" & msDbFilename
moConn.Properties("Persist Security Info") = False
moConn.ConnectionString = msConnString
moConn.CursorLocation = adUseClient
moConn.Mode = adModeReadWrite' or using default...same result
| |
by: Richard Maher |
last post by:
Hi,
I have this Applet-hosted Socket connection to my server and in an
ONevent/function I am retrieving all these lovely rows from the server and
inserting them into the Select-List. (The on screen appearance of the Select
List grows for the first 5 rows then the scroll bar appears if there's
more). So far so good. . .
The problem is that none of the rows I'm inserting appear on the screen
until I have RETURNed from my function; so If...
|
by: Michele Simionato |
last post by:
I have always been curious about how people implement mainloops (or,
in Twisted terminology, reactors). So I sit down and I wrote the
following simple implementation:
import itertools
class SimpleReactor(object):
DELAY = 0.001 # seconds
|
by: amitpatel66 |
last post by:
Hi,
Is PLSQL Anonymous block allowed in CASE WHEN statement when CASE is used in SELECT statement.
Check below code which executes but does not return anything:
SELECT job, CASE WHEN job = 'TL' THEN
DECLARE
CURSOR C1 IS SELECT ename FROM emp WHERE job = 'TL'; concat_str VARCHAR2(2000) := NULL;
|
by: tjc0ol |
last post by:
Hi guys,
I'm a newbie in php and I got error in my index.php which is:
1054 - Unknown column 'p.products_id' in 'on clause'
select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd,...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |