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 5658
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
-
-
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...
|
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...
|
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...
|
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="...
|
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...
|
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...
|
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 =...
|
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,...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
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...
| |