Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Case Select In Report, Select Expert Formula For Crystal Reports RDC

I am using Crystal 8 RDC in my VB app. I run a number of reports with paramaters which run beautifully. Typicall when I Enter a Selection formula in the Select Expert it will look something like:

{ado.Issuer} Is like {?IssuerParm}

Can anyone give me an example of how to use an If statement or a Case Select in the Select Expert of Crystal Reports RDC?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Use The Select Expert From Crystal Reports In Vb
I have designed a crystal report in vb, it runs okey but I want users to select fieids using the select expert in run mode. How to I make this possible. The selection should be by School, Programme and the year of study


Crystal Reports 9 - Select Expert - Reg:
Dear All,

In crystal reports, is there any possibility for formula fields & parameter fields to appear in select expert for selection. For example, i have created 3 groups as parameter fields for corporate companyname, Unit Name & partyname.

My intention is to select minimum 2 groups for selection for printing. At present by double clicking the group in preview mode i am able to see only that particular group. Instead if the group appears in the select expert functionality I shall be able to select multiple groups for printing.

May any one help me in this regard.

Thanx in Advance.


Crystal Report, Select Expert
Hello everybody !
I use Select expert ocx from Crystal report. I need change expressions in combo box, for example expression 'is equal to' to 'je rovno' or 'is between' to ' je mezi' and etc. Is it possible to do it ? Can I change font of Select expert ocx for example to 'Arial CE' ? Thanks Alice.

Select Expert In Crystal
I am selecting based on an organization field... Which can be all mixed case in the database... If I choose to run the report for one organization (I have a parameter field).. it does not print anything unless the organization is entered as is (case sensitive)

How can modify report so that the user's selection can be case insensitive


SQL Subquery (select In Select) In DB2 And Crystal Report 8.5
Hii, Please help me.
I make report use crystal Report 8.5 (Crystal SQL Designer) from database DB2 in AS400/IBM Server. I can not found error if use database SQL server 7 , this is my syntax create in database SQL Server 7 (Subquery/Select in select).

but if I create syntax in database DB2 ,....

     (SELECT SUM( (B.LPRQTY) ) FROM "server_name"."database_name"."DISPR00F" B
  "server_name"."database_name"."STOTR00F" A

 i found error
" ODBC error [IBM][Client Access ODBC Driver (32-BIT)][DB2/400 SQL]SQL0104 - Token Sum was not valid. Valid tokens: +)-. " , Why ? Please help Me

Thank you for you

Edited by - triary on 10/17/2003 8:30:49 PM

Select Case Structure Question How To Select Two Conditionsat A Time?
i am using combobox and listbox. I want to use select case structure
using both combo1 and list1.I know that it can be handled easyly by
using nested if sutructure,but want to know what say select case structure
im using this but it not works for both at a time. tell me is it possible
to use ?? if yes then plz tell me what the code is because
i don't know about the select case structure very much.

VB Code:
Private Sub Form_Load() Combo1.Clear    Combo1.AddItem "one"        Combo1.AddItem "two"            Combo1.AddItem "three"                Combo1.AddItem "four"    List1.Clear        List1.AddItem "1"            List1.AddItem "2"                List1.AddItem "3"                    List1.AddItem "4"  End Sub   Private Sub Command1_Click()   Select Case (Combo1.ListIndex And List1.ListIndex)     Case 0 And 0        MsgBox "one 1"             Case 0 And 1                    MsgBox "one 2 "                            Case 0 And 2                                MsgBox "one 3 "            End Select End Sub

End Select Without Select Case, But Select Case Exists...
Private Sub RecordControls_Click
Select Case Index
Case 0
On Error GoTo ErrorHandler
If MasterControl.Text = "" Then
MsgBox "You must specify a header in which to put the data.", vbInformation, App.Title
Exit Sub
End If
For i = 0 To Data.Count - 1
If Data(i).Text = "" Or DataType.Text = "" Then
MsgBox "One or more of the required fields have not been filled in.", vbInformation, "Cannot continue"
Exit Sub
End If
Next i
RecordSource = "SELECT * FROM " & MasterControl.Text & " ORDER BY Name"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "Databases" & MasterControl.Text & ".mdb;Persist Security Info=False"
rs.Open RecordSource, ConnectionString, adOpenKeyset, adLockOptimistic
For i = 1 To rs.RecordCount
If rs.BOF = False Then
End If
If rs.EOF = True Then Exit For
If Data(0).Text = rs!Name Then
MsgBox "Duplicate items not allowed", vbCritical, "Can't create record"
Exit Sub
End If
rs!Name = Data(0).Text
rs!DataType = DataType.Text
rs!Data = Data(1).Text
Set WkSpc = Nothing
Set rs = Nothing
OrganizerDatabase.ListItems.Add , , Data(0).Text
End Select
End Sub

As you can see, Select Case is the very first line in my code, yet it gives me the aforementioned error. Why is this?

Also, I need to know how to catch cancel button clicks when creating a new datalink dynamically.

This code opens a box that creates a new dynamic datalink to the database you choose. It's just like right-clicking a udl file and selecting properties.

Set conn = dl.PromptNew

I want to know how to catch cancel button clicks from this box.

How Do I Select ONLY 1 Row From Db In Crystal Reports
I have a crystal reports (6) control set up correctly in a VB 6 program. I pass it a report which is bound to a table in a database. So far so good.
What i want to do is select 1 row in the table and print that. At the moment i get a report for each row in the table.
I`ve tried setting the SQLQuery property to something sensible but it ignores me.
Does anyone know how to do this?


What Component Select For Crystal Reports XI

I'm trying to migrate from crystal reports 8.5 to crystal reports 11 but in component windows i select the crystal reports control reference C:WindowsSystem32Crystl32.ocx.

What i have to do with crystal reports 11 because i can't find the crystl32.ocx 11 for the new version.

Please Help


Select Statement With Crystal Reports
i have tried until I made myself insane, maybe its not possible
Using crystal reports in can i do a standard sql select statement?

I'm trying to select all the records in one of my tables that DO NOT match any records in a second table. I want to put these records on the report.

any iders?

Crystal Reports Custom Select
Hello All

I am using VB6, and Crystal Reports 9. I am having a problem creating a custom select command for this report. I have designed the report from within VB. Here is the situation. I have a table, 'tbl_sales_customer_items'. Inside that table are the following fields. ID (PK Field), n_sale_id, n_item_id, n_quantity, n_price. This table keeps track of everything a customer orders as part of thier sale. The pk ID field in this table is a foreign key matching tbl_sales.

Here is the problem. I need to make a crystal report that will allow me to show the most popular items customers are buying. The report should show a list of the most popular items down to the least popular items.

I tried to use the 'TOP' SQL command to not avail, it looks like to use that i need to specify the exact number of records i want in the 'TOP' listing. Since I will never know how many records there are i cannot use this command.

I tried to change the main SQL QUERY inside crystal to allow me to use the top command but i cannot find anyway to do it. There is no way to change this SQL QUERY without using the QUERY EXPERT, which does not allow you to write custom SQL commands.

So then I tried to use VB to limit the result retuned by the query. Here is the code i used.

' *** Declare and set the report properties
Dim theReport As Object
Set theReport = rptProdServPopularList

Dim crParam As CRAXDRT.ParameterFieldDefinition
theReport.EnableParameterPrompting = False

theReport.RecordSelectionFormula = "(TOP 1 {tbl_sales_customer_items.n_item_id})"

Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = theReport
Screen.MousePointer = vbDefault
RunProdServPopularList = True
Set theReport = Nothing
That keeps giving errors. What is the proper way to show the most popular products customers are buying inside of a crystal report?

Thanks for any help!

Select Printer - Crystal Reports 8
Hi there!

I'm using VB6 + CR 8 RDC + CRViewer.

I need to make it available for the user to choose the printer he wants the report to be printed.

Thanks for all your attention!

Select A Printer Programatically For Crystal Reports 10
I have an application in VB 6 which prints reports in Crystal Reports 10 without user prompting. I need to programatically change the printer depending on the report. I tried with "call CRreport.selectprinter (PrinterDrv, PrinterName,PrinterPort)" and with "set printer = MyChosenPrinter" but the program prints always in the system's printer.
Thank you for your help. I need it!

Crystal Reports RDC / Allow User To Select Printer
I need to know how to allow the user to select a printer when printing Crystal reports as opposed to just sending to the default printer.

I am currently designing my reports using RDC. I have a single form (frmRptView), with only the CRViewer control, which I call to view all of my reports.

Here is the code I am using to view a report:

Private Sub cmdViewReport_Click()

Dim Report As New NameOfReport

With frmRptView
.CRViewer1.ReportSource = Report
End With

End Sub

Now I am looking to find the code to utilize under the CRViewer1_PrintButtonClicked event procedure to allow the user to select printer. Under Crystal Care Technical Support I found the following code:

Private Sub CRViewer1_PrintButtonClicked(UseDefault As Boolean)

'Do not use the default printer dialog
UseDefault = False

'Display the Windows Standard Printer Setup dialog box.
Report.PrinterSetup Form1.hWnd

'Print the report without displaying the default printer dialog.
'If the option to set the number of pages is required then
'pass a value of True.
Report.PrintOut False

End Sub


1> In my form (with the CRViewer1 control), it does not recognize Report as object.

2> If I hardcode in the name of the report it asks me to enter parameter values. I should mention this is a paramaterized report.

So first things first, If someone could tell me how I can refer to the report from the form which I view the report that would be a start.

Select Records By Date (Crystal Reports)
Hi! I have a problem I don't know what have I need to select some records from a Crystal report, I need to select some range of dates and it always send me a message telling me that there is an error in the formula.
Can you help me it drives me crazy!!

I will appreciate all your comments.

Thank you

This is the code:

Dim DocName As String
Dim LinkCriteria As String

CrystalReport4.Connect = "DSN = hoy;UID=;PWD=;DSQ="

a = "Date(1999,01,01)"
b = "Date(1999,01,30)"

Thank you!!!
c2 = "="
c1 = "{}"
c3 = "<="
y = "and"

Set rep = CrystalReport4
rep.SelectionFormula = "" & c1 & " " & c2 & " '" & a & "''" & y & " " & c1 & " " & c3 & " '" & b & "'"
rep.ReportFileName = "d:personalvb_accesssalidas.rpt"

Select Case Err.Number
Case 20515: 'Resume Next
MsgBox ("There is an error in the selection")
Resume Next
End Select
On Error GoTo errorhandler
rep.Action = 2

Trying To SELECT Max(Date) For A Crystal Report
In my crystal report, I want to pull in the MAX(Date) for a selection of records. But every time I try edit the SQL query to do this, it won't save it. The way it is:
Customer.`CustNumber`, Customer.`Name`, Customer.`Address1`
What I want to do:
Customer.`CustNumber`, Customer.`Name`, Customer.`Address1`
How else can I select only the Maximum date for the record?

How To Select A Printer In VB Crystal Report.

How to select a printer in vb.

I have VB5, VB6 & Crystal Report.

My crystal reporter PRINT button Active only WINDOWS DEFAULT PRINTER.

Every time we are go to Control Panel - Printer Settings - select a printer & set as Default Printer.

I want choose the printer name in RUN Time.

I tried to Common Dialog aslo.

Is it possible ?

How to write the coding / settings.


Can't Select Database In Crystal Report, Need Password.
Hi All,
I create a report in Crystal Report using VB6, when i choose the
databse file in Crystal Report, i'm not able to proceed because it
prompt me to key in access password. But i do not set any password on my
database. Does anyone know why? If i'm using access97, i'll not
encounter this kind of problem. Now i'm using access2000. Is this the
Thanks in advance.

Khai Sze

How To Select Years Only From Date In Crystal Report?
Any one can tell me how can i capture Year only from date in Access database from the crystal Report?

This is the coding that i wrote, but got problem. Error message is "Type Mismatch"

Report.RecordSelectionFormula = Year("{ado.lastvisitdate}") = 2000

Anyone please correct me..thanks..

How To Select Particular Records Of Access Table From Crystal Report

how to select particular records of Access table from Crystal

Report at runtime using Visual Basic / Visual C++.



Can A Case In A Select Case Statement Call Other Statements?
I have a Select Case statement where each case has 10 - 20 lines of code. If the user selects the "master" option, I would like that case to call all of the other cases. That way, I don't have to retype all the code.

For example, if you had a text box with a command button, the kind of case I'm looking for would look like:

Private Sub Command1_Click()Select Case Text1Case "A"Call cases "B" and "C"Case "B"MsgBox "B"Case "C"MsgBox "C"End SelectEnd Sub

So if the user typed "A" and clicked, there would be a "B" messagebox and a "C" messagebox.

Does anyone know if this can be done?

Thank you,

Steve Geller

How To Make VB's Select/case Mimic C's Switch/case
in C, I can do this


case 1:
case 2:
case 3:
Case 1-2-3");



in VB when I try to do this

number = 1

select case number

case 1
case 2
case 3

case else
'none of the above

end select

the case else path is taken.

It appears that the case in C are or'd but in vb they are not

I also tried this

number = 1

select case number

case 1 or 2 or 3

case else
'none of the above

end select

but the else path was taken again.

Is there something I'm missing, or can't this be done in vb ?
I don't want to check for a range of values, just a few discrete values.

Using .RecordSelectionFormula And Select Expert Together
Can I use .RecordSelectionFormula in VB and Select Expert in Crystal together, when calling a report from VB? If so how?

Basically I have a list to allow the user to select a customer from in VB, and a date range to select from in the crystal report.

The reason I dont have both in the VB application is that I want the date range entered to appear on the report - so need to create the parameters in the report.

The reason I don't have both in the report is that I want to display the list of customers for the user to select from. If I create a default list and save the report, then I add a new customer, this customer doesn't appear on the list when I re-run the report.

Can I create a default list that will take all from the customer list?? I have tried doing Customer.* in the default list, but this doesn't work.

How To Use Crystal Reports To Make The Dynamic Reports?(I Can't Use The Design Expert To D
  How to use Crystal Reports to make the dynamic reports?(I can't use the design expert to design the report,because the data source with different fields is unknown in design time.)
     Hello all!
     I use the dynamic generating MS Access table as the Data Source of Crystal Report.
How to use the Crystal Reports to display the data of the dynamic generating MS Access table?
     Thanks All!

Edited by - on 12/17/2003 9:37:59 PM

Temporarily Removing A Case From Case Select
hey, just wondering if it could be done.

i'm making a black-jack game for school, and i need a way to keep used cards from being chosen twice, and i'm using a case-select to do it. i've tried a few different things, such as a Do While loop, and various others.

i was also thinking i could make an array and dump all the used cards into it, and the compare them when the "Hit" button is pressed, but i'm not sure about the syntax and the coding for it.

i was also wondering if you guys knew of a better way to select the cards. writing a case select with 52 cases everytime looks terrible ...

so yeah, any suggestions?

Case Without Select Case? + Use A Variable As A Function?
I am making a maths quiz in VB6 for a school project, and i'm in a bit of a rut. Basically, i'm trying to write the code for when a user answers a question. The function (Addition, Subtraction, Multiplication, Division etc) is defined using randomly generated numbers (eg, 1 = "+").

So basically i've tried to say "if answer is equal to the equation, then do this, or do this"

I have the function setup like this (where label3.caption is the math function)

If Label3.Caption = 0 Then
Label3.Caption = "+"
ElseIf Label3.Caption = 1 Then
Label3.Caption = "-"
ElseIf Label3.Caption = 2 Then
Label3.Caption = "*"
ElseIf Label3.Caption = 3 Then
Label3.Caption = "/"
End If

I originally wanted to simply do something like "if firstnumber (label3.caption) secondnumber, then etc"

I couldn't figure out a way to do this, so i decided i would try a case select.
No matter what i do i get the error "Case Without Case Select"

Private Sub Command1_Click()
' if user's answer in the text box is correct or not show msg box, do array to store
' the score, etc

functioncase = Label3.Caption + 1

Select Case functioncase

Case 1
If Text1.Text = Label1.Caption + Label2.Caption Then

Case 2
If Text1.Text = Label1.Caption - Label2.Caption Then

Case 3
If Text1.Text = Label1.Caption * Label2.Caption Then

Case 4
If Text1.Text = Label1.Caption / Label2.Caption Then

Case Else
MsgBox "WFTF"
End Select

End Sub

I have no idea how to get this working!
Please share your knowledge with me.

Select Case Default *RESOLVED: Case Else*
Is there a default case? In C++ you simply insert a "Default:" into the select and it handles all other cases that you don't look for. Simply, a default case would be the 'else' of a select case statement. Something like this ....

VB Code:
yellow = "no" Select Case yellow     Case "yes": MsgBox "It is yellow."     Default : Msgbox "It is not yellow."End Select

... thanks.

Case Without Select Case Error For No Reason

This is very nonsense. That error keeps popping up at run time for absolutely no reason as far as i'm concern because i can't think of ANY reason why it wouldn't work. IT is a simple tic-tac-toe game ( not finished yet ) and i hope you people can have a look at the source ( very short ) and solve that select case error.

many thnx

Class Err (reserved For Expert)
(refer to at:

On running

「running error '1004':」
「Class Range ... select... method error」

The problem may arise from this:

"db_rsImport", "db_rsExport" and "db_rsStock" are DYNAMIC RANGES defined by 'offset' function
(for the purpose that in the three data-table, *only unlock* those cells with data and the row just below the last record) .

How to solve it?

Crystal Reports Expert?
Is it possible to put multiple graphs onto one report using Crystal Reports latest software?

I can only see an option to insert on graph per report...

please help!

Skipping A CASE In Select Case...
Not sure exactly the best way to ask this, so I'll try bluntly.

I have a select case WITHIN a select case.

For the 1st case, I have 3 options
For the 2nd case, I have 4 options

such as...

Select Case FillMethod
Case 0 'Normal Fill Style
Select Case FillStyle
Case 0
Case 1
Case 2
Case 3
End Select
Case 1 'Center Out.
End Select
End Select
Lets say, FillMethod evaluates to 0
In that case, 0 and 1 (Of FillStyle) are both going to do the same thing, but i can not remove one in favor of the other, because it is used elsewhere in code.

Is there a way to do this? If FillStyle evaluates to Case 0, or Case 1, run the code ONCE, or replace the 2 Case statements with something like Case 0 OR 1 ?

Case Select Adding A New Case
is it possible to add a case to a select case object from within the code.

i have a ascii file with customer adresses but every now and then there is an updated file with new customers, now i wont to import this file and a case for every adress, but this has to go the code has to generate more cases and combobox1.additem

the code:

Private Sub UserForm_Initialize()

ComboBox1.AddItem "adress 1" 'ListIndex = 0
ComboBox1.AddItem "adress 2" 'ListIndex = 1
ComboBox1.AddItem "adress 3" 'ListIndex = 2
ComboBox1.AddItem "adress 4" 'ListIndex = 3
ComboBox1.AddItem "adress 5" 'ListIndex = 4
ComboBox1.AddItem "adress 6" 'ListIndex = 5

ComboBox1.Style = fmStyleDropDownList
ComboBox1.BoundColumn = 0
ComboBox1.ListIndex = 0

End Sub

Private Sub ComboBox1_Click()
Select Case ComboBox1.Value
Case 0
Label2.Caption = "adress 1"
Label3.Caption = "street 1"

Case 1
Label2.Caption = "adress 2"
Label3.Caption = "street 2"

Case 2
Label2.Caption = "adress 3"
Label3.Caption = "street 3"

Case 3
Label2.Caption = "adress 4"
Label3.Caption = "street 4"

Case 4
Label2.Caption = "adress 5"
Label3.Caption = "street 5"

Case 5
Label2.Caption = "adress 6"
Label3.Caption = "street 6"

End Select

End Sub

thx for any help.


Crystal Reports (Again) Expert Required

Quick question.

Is it possible to create a report in Crystal Reports without linking it to any datasource?

I want to is attach a datasource from within VB. Is this possible?

I am currently linking via an ODBC source to an external database - but its slow. I have found that copying the data into Access and firiing the report from there speeds it up no end but I can't find a way to change to source of the report at runtime.

Any suggestions. Or maybe someone can suggest a way in which I can speed up my reports using the ODBC (please dont state the obvious - ie bigger hard drive etc, I've done all that).

Help appreciated.



SelectionFormula Crystal Reports - Expert Wanted
Dear All

I was wondering whether anyone could help.

How come when I hard code in the selection formula it works fine but when I build the selection formula via a string it fails to launch the Crystal report window and work.

I have checked the string and it gives the EXACT syntax as the hard coding. Still it doesn't work.

I am at a loss as to why it doesn't work - Suggestions please.

Below is an example of my code. The string is built on the contents of a list box. Code is best viewed in 'Courier font' as I'm sure you'll already know.

Dim frmcount As Integer
Dim frmloop As Integer
Dim result As String

frmcount = List1.ListCount - 1

result = Chr(34) & "{query.lot_number}='"

For frmloop = 0 To frmcount
result = result & List1.List(frmloop) & "'"
If frmloop <> frmcount Then result = result & " or {query.lot_number}='"
Next frmloop

result = result & Chr(34)

RecallReport.SelectionFormula = result



Select Case Help
I'm trying to create a Blackjack game but I'm having trouble with my select case code, here's a portion of it -

playerscore(1) = 0
playerscore(2) = 0
For x = 1 To playercount
Select Case playerscard(playercount)
Case Is = "Heart1" Or "Diamond1" Or "Club1" Or "Spade1"
playerscore(1) = playerscore(1) + 1
playerscore(2) = playerscore(2) + 11
Case Is = "Heart2" Or "Diamond2" Or "Club2" Or "Spade2"
playerscore(1) = playerscore(1) + 2
playerscore(2) = playerscore(2) + 2
That code is used to calculate the players score, there are two score in case the user has an ace. (there is also more cases for the select case)

My problem is that when I run the code I get a type mismatch error on this line -

Case Is = "Heart1" Or "Diamond1" Or "Club1" Or "Spade1"
I have the playerscard(playercount) variable declared as a string. Does anyone know how to fix this error? Also, if anyone has a better idea about calculating the score instead of select case, I'd like to hear it. :P

Select Case Using And
Hello, I am working with VBA in Excel

I am having a select case problem with the And operator, my code goes as such:

Select Case FinishInch

Case Is <= 0.00033
FinishInt = 60
Case Is > 0.00033 And FinishInch <= 0.00037
FinishInt = 59
Case Is > 0.00037 And FinishInch <= 0.000415
FinishInt = 58
End Select

The problem is if for instance FinishInch is = .000410 it should give a value for FinishInt as 58. however it doesnt seem to be getting past the first AND operator.
No matter what the value of FinishInch is, as long as it is > .00033 FinishInt gets a value of 59.

I have tried defining FinishInch as double, single and variant with no success.

What am I doing wrong???


Using Select Case With Or
I have the following example:

Sub myexample()
Dim myVar As String

myVar = "one"

Select Case myVar
'this is where the error occurs
Case "One" Or "Two"
MsgBox "ok1"
Case "Three"
MsgBox "ok2"
End Select

End Sub

I get a type mismatch error where the case is "one" or "two". Does anyone know how to make the select case work for different possabilites.

Select Case
Hey I am having trouble using the Select Case code in vb. I am trying to use it for a progress bar. I have the program designed to initiate Timer1 whenever cmdInstall is clicked. I am trying to place the Select Case in the timer sub in conjunction with a progress bar. every case i want the progress bar to increase by so many increments, and I want so much code to be completed as well.. any help? Thanks!

Select Case Help
I'm trying to do the following in VB, but it doesn't work, if x is set to "1" or to "2", The Case Else: still triggers.
Here's the code:

Sub Main()
Dim x As String

x = "1"

Select Case x
Case "1" Or "2":
MsgBox "1 or 2"

Case Else:
MsgBox "else"

End Select

End Sub
If I change the Case "1" Or "2" to Case ".vbs" Or ".js" I get an type missmatch error on that line. I'm sure it's becuase of Or operating as adding those two together or something, but I can't find any solution for it.

How should I do this?

Select Case Help..?
Im making a grading program for my Intro to Pro VB class with VB6 im missing something in this code and I can't figure it out.. please help me asap..

Private Sub cmdCalculate_Click()
sngTest1 = Val(txtTest1.Text)
sngTest2 = Val(txtTest2.Text)
sngTest3 = Val(txtTest3.Text)
If ValidGrade(txtTest1.Text) And ValidGrade(txtTest2.Text) And ValidGrade(txtTest3.Text) Then
mintAverage = (sngTest1 + sngTest2 + sngTest3) / 3
End If
txtGrade.Text = mstrGrade
Select Case mintAverage
Case "0" To "58"
mstrGrade = "F"
Case "59" To "68"
mstrGrade = "D"
Case "69" To "78"
mstrGrade = "C"
Case "79" To "89"
mstrGrade = "B"
Case "90" To "100"
mstrGrade = "A"
End Select
End Sub
*ValidGrade is a private funcation for validating the numbers input into txtTest1.text thru txtTest3.text is between 0 and 100*
If all code is needed let me know and ill post it all... it isnt that long..
when I click Calculate when testing it it takes the mstrGrade for the first ="X" no matter what it is, i want it to take the average of the 3 txtTests then use that to determine the grade, so that using the select case depending on what its between it defines txtGrade.text as the letter grade associated with that specific case.
THanks for any help... I need this done by tuesday plus another project.

Select Case Help
1. It asks me for the date of the holiday
2. I enter which day, ie, Monday, Tuesday, etc
3. It should go to the proper Case and then perform that action.

It does't do it, so could anybody take a look and see what I am doing wrong.

Response = MsgBox(HolidayMessage, HolidayStyle, HolidayTitle)
If Response = vbYes Then
HolidayDate = InputBox(InpHolidayMsg, InpHolidatyTitle, InpHolidayDef)
Else: End
End If

Select Case HolidayDate
Case Monday
Range("C6:C14").Value = "Holiday"

'Range("C16:C28").Value = "Holiday"

Case Tuesday
Range("D6:D14").Value = "Holiday"

Case Wednesday
Range("E6:E14").Value = "Holiday"

Case Thursday
Range("F6:F14").Value = "Holiday"

Case Friday
Range("G6:G14").Value = "Holiday"

Case Saturday
Range("H6:H14").Value = "Holiday"

Case Sunday
Range("I6:I14").Value = "Holiday"
End Select
'End If
End Sub

Select Case Help????
ok i have a form with 14 option buttons on them named optMod(0), optMod(1), optMod(2), etc....

right now i am using if then statements

If optMod(0).Value = True Then
MsgBox ("0")
ElseIf optMod(1).Value = True Then
MsgBox ("1")
ElseIf optMod(2).Value = True Then
MsgBox ("2")
End If

what is the correct syntax to re-write this using a case statement... i have used them, but never with option buttons.

Select Case Vs. If...then
if i am testing a condition like the following, is it better to use a case statement or a bunch of if then statements.

i have a grid that i am looping through... i check to see if the text is red, yellow, green, blue, orange, or purple... once it checks the text it changes the field to a different word

'red' becomes 'obsolete'
'yellow' becomes 'sole source'

so should i use a case or if statement and why?

If...Then...Else Or Select Case?
I have a form with many command buttons. Depending on which comdbutton is clicked, a [pre-saved] document will open. It may be a document, spreadsheet, .pdf file, database or whatever. I'm pretty sure I can do it as an If...Then...Else statement but would a Select Case statement be more efficient?. I had it running with each button having it's own click event but it won't compile - 'out of memory error'. If the Select Case Statement is the better option, can someone give me an example to kick it off please? I am using VB5 and VB6. Also, how the hell do I get an .avi or .swf file to run as a click event?

Thanks heaps

Need Help With Select Case...
Well, I thought everything was going alright until I noticed my tickers/counters weren't updating correctly. Here's my code:

tcount = 8

Select Case Len(tcount)
Case "1"
frmBis.imgT4.Picture = LoadPicture(App.Path & "Images" & tcount & ".bmp")

Case "2"
intDigit1 = Left$(tcount, 1)
frmBis.imgT3.Picture = LoadPicture(App.Path & "Images" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "Images" & Right$(tcount, 1) & ".bmp")

Case "3"
intDigit2 = Left$(tcount, 1)
intDigit1 = Left$(tcount, 2)
intDigit1 = Right$(intDigit1, 1)
frmBis.imgT2.Picture = LoadPicture(App.Path & "Images" & intDigit2 & ".bmp")
frmBis.imgT3.Picture = LoadPicture(App.Path & "Images" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "Images" & Right$(tcount, 1) & ".bmp")
End Select

Now, the "tcount = 8" is NOT part of the code. It will always start out as "0" and then the code will do "tcount = tcount + 1". I just have it in there so that I can test high numbers without having to step through the code in order to increase the count.
Anyway, no matter what value I make tcount, the "Len(tcount)" will always return a 2. All the variables included (tcount, intDigit, etc) are stored as integers. My "ticker/counter" will allow up to 9999, though more than 99% of the time, numbers will not go above 250.
Does anyone know why this is not working? I could probably just set a new variable to store the length of tcount before I enter the Select Case, right? It would be something like this:

tcount = 8665

NewVar = Len(tcount)

Select Case NewVar
Case "1"
frmBis.imgT4.Picture = LoadPicture(App.Path & "Images" & tcount & ".bmp")

Case "2"
intDigit1 = Left$(tcount, 1)
frmBis.imgT3.Picture = LoadPicture(App.Path & "Images" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "Images" & Right$(tcount, 1) & ".bmp")

Case "3"
intDigit2 = Left$(tcount, 1)
intDigit1 = Left$(tcount, 2)
intDigit1 = Right$(intDigit1, 1)
frmBis.imgT2.Picture = LoadPicture(App.Path & "Images" & intDigit2 & ".bmp")
frmBis.imgT3.Picture = LoadPicture(App.Path & "Images" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "Images" & Right$(tcount, 1) & ".bmp")
End Select
Would this be better to do or does it really matter? If you need any more info, please let me know.


Select Case
can anyone give me an example of how a select case works?

Select Case?
how can i do this?

select case x
case is <90 and is>3
do something
case is>0 and is <4
do something else
end select

i need to know how to use the IS and AND in a case statement to test if something is in a certain range

Using OR In A Select Case
Just wondering if one can use OR in a case?

Select Case p_RawRecord(p_FieldNumber)
Case "IV" Or "IVORY"
p_FinalRecord(14) = "IVORY"

Case "BK" Or "BLACK" Or "BLK"
p_FinalRecord(14) = "BLACK"

Case "WH" Or "WHITE"
p_FinalRecord(14) = "WHITE"

Case "GY" Or "GRAY"
p_FinalRecord(14) = "GRAY"

p_FinalRecord(14) = "LT GRAY"

Case "BR" Or "BROWN"
p_FinalRecord(14) = "BROWN"

End Select

Otherwise i can just do individule cases for each case.


Select Case
I need to make a tic tac toe game and use the DragDrop Event, and DragIcon and DragMode properties to make it work.

I am stuck on how to write code to check for a winning tic tac toe combinaiton.

I know that there are 8 combinations of indexes of the imgBoard control where all three images are the same and result in a winner of that current source control (being the last image dragged and dropped onto the board)

indexes that are winners:
0, 3, 6
1, 4, 7
2, 5, 8
0, 1, 2
3, 4, 5
6, 7, 8
0, 4, 8
2, 4, 6

I tried a series of if...else...then loops to check if the source.picture matched the image control in the imgBoard array, but I am getting an error with my if...else....then loop.

Please point me in the right direction.

Copyright 2005-08, All rights reserved