Questions tagged [select-case]

164 questions
0
votes
1 answer

TSQL: SELECT CASE WHEN THEN Subquery: Error: Subquery returns more than 1 Value

im getting the error Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. in the query below select case when serial_number like…
Tobi89
  • 199
  • 2
  • 4
  • 11
0
votes
1 answer

Repeat macro after UserForm Input

The macro ,upon opening the workbook, will look to see if cell "C27" contains any of the following Text: Location1, Location2, Location3, or Location4. If they do then it will continue to save 2 copy files of the template by those locations. If not…
Duraholiday
  • 111
  • 1
  • 3
  • 14
0
votes
4 answers

SQL Select within Sub Query

Hi My query is as follows, and contains a subquery within it: ALTER PROCEDURE [dbo].[POBalance] @PONumber NVARCHAR(50) AS BEGIN SELECT CASE WHEN X.STATUS = 'False' THEN ( SELECT A.Description …
Daryl
  • 35
  • 1
  • 7
0
votes
1 answer

Select case for various input amounts

This is what I have so far; Function myChoice(ByVal opt1 As String, ByVal opt2 As String, ByVal opt3 As String, ByVal opt4 As String) Dim choose As String Dim mynum As Integer Randomize() mynum = Int(Rnd() * 4 + 1) Select…
Scott A
  • 15
  • 3
0
votes
3 answers

VB select case not working as expected

I am a total novice with visual basic and teaching myself as I go along. I am building a VB in studio 2008 (I'm obliged to use this version) that logs into a device , transmits log in and password and then transmits commands read from a .txt file…
Dimbert
  • 11
  • 3
0
votes
1 answer

SQL Server 2008 R2 – Reducing multiple rows into one

I need to have my data showing in one row whether an individual has 'Finished' specific courses within the last 3 years. This is my existing table & desired table (hope this link works as I can't post images…
ttratl
  • 21
  • 8
0
votes
1 answer

Age based "Select Case"

So I am trying to code a button that reads the age entered by the user and determines what price they receive. Below is how I have tried doing this with no luck. Private Sub btnSelect_Click(sender As Object, e As EventArgs) Handles…
King96
  • 47
  • 2
  • 14
0
votes
2 answers

How to use case structure for comparing string

So i have a table in excel with different names. I am trying to parse through the table and depending on the name in each cell, change the cell background color. I tried to use a switch control, but its not working for me as some of the names are…
mg555
  • 13
  • 2
0
votes
2 answers

How to select cases in SPSS in a stacked data set

I have a very large (949,000 obs.) stacked (long form) data set. I would like to select cases based on the presence of data in one variable but keep the other stacked data for that Unique ID. Does that make sense? Do you have any thoughts?
Jake
  • 3
  • 1
0
votes
2 answers

Case Select Statement Crashes Excel

Bear with me, I'm learning Excel VBA as I go so excuse any dodgy code. This one has just stumped me - I'm sure I'm missing something pretty obvious but I just can't see it! I'm trying to refine my code from an extended IF (which works) to a Select…
Harley B
  • 543
  • 5
  • 14
0
votes
1 answer

Excel VBA - Select multiple values to search a Case

I wrote a program that totals the number of times X number of widgets are tested in a day based upon a start and end count. After a period of time a widget will fail and have to be replaced, thus the count will start back at zero. I am using a…
0
votes
1 answer

Using SELECT CASE to Manage Production Tables

I'm trying to use a Select Case to log production time-tables. I've tried a couple angles - one being Select Case. Every time I run the Macro I get the default ERROR "Wrong Model Entered...." Private Sub Transfer() Dim ModR As String Dim Count1…
0
votes
2 answers

How to create my commands except select case method vb.net

Making a textbased game. I have a command prompt its made from richtextbox as outputbox and textbox for inputtextbox. i need to make some commands like "cls" "dir" "config". lots of more commands in my list. i just stuck how to that and how to…
Corviuse
  • 7
  • 3
0
votes
1 answer

Excel VBA For Each Case Send Email

Hi I am using the below code to send multiple emails based on different cases. (Email addressess and other information are stored in a worksheet) The code works fine however I have 20 different cases (example below only shows two). Putting the…
user2877688
  • 1
  • 1
  • 1
0
votes
1 answer

select case with variable boolean operator

This is my first question on the forum, but reading previous questions has been enormously helpful in the project I'm working on, so already my thanks. I couldn't find an answer to this, but apologies if I overlooked something. I am writing an excel…
Joshua F.
  • 3
  • 1
  • 2