Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Parameters

Status
Not open for further replies.

Petemush

Technical User
Jun 21, 2002
255
GB
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
 
Hello!

Try this one :

Public Function Testing(Whatever As TextBox)
DoCmd.RunSQL " SELECT * INTO [tblTempFind] " &_
"FROM [tblCourses]" & _
" WHERE (([Trainer].Value) = "& Whatever & ");"
End Function

I hope this one will help you.

Au revoir ...
 
Thanks botte

but now it' asking me for Trainer.Value and also whatever I type in the TextBox,

ie. if I type hello it asks for the parameter Trainer.Value and then the parameter hello.

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top