I might be repeating myself from an earlier question but hopefully this seems simpler and someone can help.
Public Function Testing(Whatever As TextBox)
DoCmd.RunSQL " SELECT * INTO [tblTempFind] FROM [tblCourses]" & _
" WHERE (([Trainer].Value) = Whatever);"
End Function
Why does the above not work? It's called from an On_Click of a button on a form and passes a TextBox to the function. I did have a Debug.Print expression to check the values and it was all fine. The problem is, I still get asked for the value of Trainer when it should be comparing to the passed value. I've tried passing strings and typing [Trainer].Value but to no avail. All I want it to do is paste into a table the values in the field [Trainer] from the table tblCourses that match what was typed in the textbox on the form.
Please help, it's driving me insane.
Thanks,
Pete
Public Function Testing(Whatever As TextBox)
DoCmd.RunSQL " SELECT * INTO [tblTempFind] FROM [tblCourses]" & _
" WHERE (([Trainer].Value) = Whatever);"
End Function
Why does the above not work? It's called from an On_Click of a button on a form and passes a TextBox to the function. I did have a Debug.Print expression to check the values and it was all fine. The problem is, I still get asked for the value of Trainer when it should be comparing to the passed value. I've tried passing strings and typing [Trainer].Value but to no avail. All I want it to do is paste into a table the values in the field [Trainer] from the table tblCourses that match what was typed in the textbox on the form.
Please help, it's driving me insane.
Thanks,
Pete