View/debug what is actaully being searched for?

jomuir

Registered User.
Local time
Today, 14:30
Joined
Feb 13, 2007
Messages
154
I have created a few forms which search for data, so far all of these work – well I have one problem that I have already posted.....

However I was wondering if there is a way of actually seeing what your are search for i.e. when I click the search button, it goes through the code and searches, but can I see the actual search criteria?

So I have some searches that will only use 1 field out of a possible 5 fields, so could I see the actual searching criteria like:-

SELECT tbl05to06
FROM tbl05to06
WHERE (tbl05to06.Centre)>="2A7T1"
 
If you are dynamically creating the SQL strings with VBA code then you can either display the String within a Message Box or a Text Box on Form.

Code:
Dim StrgSQL As String

[COLOR="DarkGreen"]'Create the SQL String.[/COLOR]
StrgSQL = "SELECT tbl05to06 FROM tbl05to06 WHERE tbl05to06.Centre)>='2A7T1';"

[COLOR="DarkGreen"]'Display The SQL String (for testing only).[/COLOR] 
MsgBox StrgSQL

[COLOR="DarkGreen"]'Fire the SQL String.[/COLOR]
CurrentDB.Execute StrgSQL, dbFailOnError

.
 

Users who are viewing this thread

Back
Top Bottom