Expand|Select|Wrap|Line Numbers
- Function Test(fsHistoryId As String, fsTemplateId As String)
- Dim lsSqlToRun As String
- Dim db As DAO.Database
- Set db = CurrentDb()
- lsSqlToRun = "Select * INTO tblTemp from " & fsTemplateId & " where historyid = '" & fsHistoryId & "';"
- db.Execute lsSqlToRun
- End Function
When I use the text from this variable and execute the sql separately, it works. I am not sure what is wrong with the above code. I need to pass the table name as a variable. Any ideas on what could be wrong. Thank you for the help in advance.