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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Text Box values used in query(macro)

Status
Not open for further replies.

jhughes200

IS-IT--Management
Mar 7, 2007
4
US
I am attempting to use the values of two text boxes as search criteria in a query. I know I have the Form/ Text box name correct in the query. The problem is I am not getting any results when the contents of the form text box is set to a general number or General Date. I can only seem to pass TEXT values to the query not numeric. When displaying the contents of the numeric text boxes on the form in the query result, the values are illegible charactes.

Any ideas?

Thanks
 
If you are passing dates, they need to be delimited with the #, strings are delimited with " in Access and ' in other languages and numeric fields aren't delimited at all.

What's the actual SQL of the query?


Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Leslie:

Thank you for your reply. What I was actually trying to do is kick off a macro to call a query on LOST FOCUS to retrieve additional information from a table to poulate a different field on the screen. I generated the query in design view, but here is the actual SQL.

SELECT Forms![Questionnaire Input Form]![scrntxt quesnum] AS [ques num], Forms![Questionnaire Input Form]![scrncmb subques] AS [sub ques], Forms![Questionnaire Input Form]![scrntxt testdate] AS [tst date], [Question Table].[qt-questionnaire]
FROM [Question Table]
WHERE ((([Question Table].[qt-questionnaire])="a"));


As I said in the original problem, I can pull Text but not dates and numerics. I need to have the numerics, because the key I am trying to access (Question Number) in the table is a numeric field for sorting purposes.

Thank you

Jay
 
Leslie:

By the way, I am using an Access DB not a SQL DB. Everything (macros, queries, tables, forms' is contained within this single MS Access DB.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top