Hello,
I am trying to run a query from under a action button and this query needs to pick up two variables (Parameters). The parameters are entered as text in two text boxes on a form. This form also is home of the button that runs the query.
My code looks like :
Dim SelectionSQL As String
Dim Var1 As String
Dim Var2 As String
Var1 = Me.Text15
Var2 = Me.Password
SelectionSQL = ” SELECT tblStudent.StudentID,tblStudent.Name,tblStudent.StudentPassword FROM tblStudent WHERE (((tblStudent.Name) = “” & Var1 & “” AND ((tblStudent.StudentPassword) = “” & Var2 & “”)))”
DoCmd.RunSQL SelectionSQL
When I run this I keep getting the error message “Run Time Error 2343”, “A run SQL action requires an argument consisting of an SQL statement.”
Does anybody know what I am doing wrong or why this message keeps occuring ? Any help or suggestions would be much appreciated.
Regards,