I am trying to use a string Value in an SQL statement. The string Value is "strTabNo". When I hard code the value in as shown below my code works.
But I have not been successful in adding the string Value in the code. This is only one of many code variations I have tried.
What is the proper syntax for adding a string value in the code? The first instance of the string value works fine.
Code:
strSQL = "SELECT tblData.* FROM tblData WHERE tblData.TopicHead" & strTabNo & _
" = '" & Forms!frmMain.TopicHeadA & "'"
But I have not been successful in adding the string Value in the code. This is only one of many code variations I have tried.
Code:
strSQL = "SELECT tblData.* FROM tblData WHERE tblData.TopicHead" & strTabNo & _
" = '" & Forms!frmMain.TopicHead & "' & strTabNo"
What is the proper syntax for adding a string value in the code? The first instance of the string value works fine.