Solved

use sql recordset column names that are similar with select case statement

Posted on 2009-04-13
3
374 Views
Last Modified: 2012-06-21
Sorry about the bad title but I didn't know the best way to explain what is probably easy for the Experts.

This throws the error "Item cannot be found in the collection corresponding to the requested name or ordinal." and I know why but not how to fix it.

"mc_poverty_temp" is not a column in my SQL table but as you can see with my first select case I'm try to make life easier by building the field name I want to use in the table.

The second select case adds on a number to the end.  That completes the column name I want to use.

How do I get the code rsGetRecord("mc_poverty_temp")   to use   "mc_poverty_temp" variables value I built to get that column data?

For example, if the 1st select case choice is "HI" and the second select case choice is 2 then the table column name I need to get at is "pg_hi2".

Regards,
Torrey
Select Case rsGetStates("state_short")

	Case "AK"

		mc_poverty_state = "pg_ak"

	Case "HI"

		mc_poverty_state = "pg_hi"

	Case Else

		mc_poverty_state = "pg_rest"

End Select
 
 

Select Case Cint(mc_hh_members)

	Case 1

		mc_poverty_temp = mc_poverty_state + "1"

		If rsGetRecord("mc_poverty_temp") = False Then mc_valid = True

	Case 2

		mc_poverty_temp = mc_poverty_state + "2"

		If rsGetRecord("mc_poverty_temp") = False Then mc_valid = True

	Case 3

		mc_poverty_temp = mc_poverty_state + "3"

		If rsGetRecord("mc_poverty_temp") = False Then mc_valid = True

End Select

Open in new window

0
Comment
Question by:elitesys
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 125 total points
Comment Utility
try without ""

like this

If rsGetRecord(mc_poverty_temp) = False Then mc_valid = True
0
 
LVL 39

Expert Comment

by:Pratima Pharande
Comment Utility
or if you cna chnage it ot numbers

If rsGetRecord(1)= False Then mc_valid = True
0
 
LVL 2

Author Closing Comment

by:elitesys
Comment Utility
Thanks, duh on me!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This article discusses four methods for overlaying images in a container on a web page
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now