Solved

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

Posted on 2009-04-13
3
387 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:Torrey Bates
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 125 total points
ID: 24128406
try without ""

like this

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

Expert Comment

by:Pratima Pharande
ID: 24128408
or if you cna chnage it ot numbers

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

Author Closing Comment

by:Torrey Bates
ID: 31569423
Thanks, duh on me!
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 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