how to run a string?

mooch911
04-14-2004, 06:41 PM
Hello, need help.

I want to be able to run a string as a command.

Dim rst As Recordset
Dim help As String
Dim Q1 As String
Dim Q2 As String

rst.addNew
Q1 = "Q1"
Q2 = "Q2"
help = "rst!" +Q1+ "= txtbox1"

now how do i execute "help" as a command? Is there a method out there to do this?

Thanks a bunch.

MikeJ
04-14-2004, 06:50 PM
Why can't you just do this:

TxtBox1.Text = rst.Fields(Q1)
'OR
'TxtBox1.Text = rst!Q1


Actually, what are you trying to do?

CrystalWizard
04-14-2004, 06:52 PM
you can try help.execute(like an SQL statement) although I don't believe it is possible to run a string like it's shown.

mooch911
04-14-2004, 07:01 PM
I have 89 different surveys that uses questions from a pool of 40 questions. Each survey has 10 questions. I have a database table with 41 columns that correspond with the 40 different questions. Each new survey is a new row of the table. I want to enter the response to each question from the survey into the corresponding column in the table. IE. Answer from Q1 goes into column Q1, answer from Q34 goes into column Q34.

Thanks for any assistance you may be able to provide.

MKoslof
04-15-2004, 07:14 AM
You are going to have use the command object's or connection object's execute method. There is no way to "execute" a string.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum