D
Dynamo
Hi,
I am trying to insert a record into a table based on inputted info from a form
using the code builder. Code is as follows:
Dim Sql As Text
Dim TT As Text
TT = IIF([Text1]="Prefault","Yes","No")
SQL = "INSERT INTO MyTable ([Answer]) VALUES (TT)"
DoCmd.Runsql SQL
The above code does not work. When it is executed I get an input box asking me
to insert a parameter for TT. I have tried replacing TT with [TT]and 'TT' and
get the same result. I have also tried replacing TT with "TT" which actually
inserts the text "TT" into the table.
I know that the variable TT has been assigned the value Yes or No because I have
tested it using another function. So where am I going wrong. What Syntax should
I be using in the SQL statement.
TIA
Dynamo
I am trying to insert a record into a table based on inputted info from a form
using the code builder. Code is as follows:
Dim Sql As Text
Dim TT As Text
TT = IIF([Text1]="Prefault","Yes","No")
SQL = "INSERT INTO MyTable ([Answer]) VALUES (TT)"
DoCmd.Runsql SQL
The above code does not work. When it is executed I get an input box asking me
to insert a parameter for TT. I have tried replacing TT with [TT]and 'TT' and
get the same result. I have also tried replacing TT with "TT" which actually
inserts the text "TT" into the table.
I know that the variable TT has been assigned the value Yes or No because I have
tested it using another function. So where am I going wrong. What Syntax should
I be using in the SQL statement.
TIA
Dynamo