• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

Change fieldname in recordset by a variable


i have the code
useletter = F1
set rs = db.openrecordset("TempTable",dbopensnapshot)
if rs! & useletter = 1 then
msgbox("no")
else
msgbox("yes")
end if

the rs! & useletter does not work, how can i make that to work? the use letter will change through the program as its moving to the next field. F1, F2, F3, F4. Or if there's another way of getting to the next field will be easier?
0
repco
Asked:
repco
  • 4
  • 3
1 Solution
 
Rey Obrero (Capricorn1)Commented:


useletter = F1
set rs = db.openrecordset("TempTable",dbopensnapshot)
if rs.eof then exit sub

if rs("useletter") = 1 then
msgbox "no"
else
msgbox "yes"
end if
0
 
Rey Obrero (Capricorn1)Commented:
useletter = F1
set rs = db.openrecordset("TempTable",dbopensnapshot)
if rs.eof then exit sub

if rs("& useletter &") = 1 then
msgbox "no"
else
msgbox "yes"
end if
0
 
Rey Obrero (Capricorn1)Commented:



useletter = "F1"
set rs = db.openrecordset("TempTable",dbopensnapshot)
if rs.eof then exit sub

if rs(useletter) = 1 then
msgbox "no"
else
msgbox "yes"
end if
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
repcoAuthor Commented:
I'm getting item not found in this collection highlighting rs1(" & useletter & ")

useletter = "F7"
0
 
repcoAuthor Commented:
rs(" & useletter & ") i meant
0
 
repcoAuthor Commented:
thx
0
 
Rey Obrero (Capricorn1)Commented:
use the codes from http:#a37287536 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now