Code not PROPERLY working??

agehoops

Registered User.
Local time
Today, 20:02
Joined
Feb 11, 2006
Messages
351
I've got the following code to ask the user what criteria they want to use for generating an SQL string which is then used to generate a custom report. Now it does work and registers what the user types in, however, all it does when it opens the report is bring up another input box with what I typed in as its heading and asks for the input again? Why?

Thanks

Code:
For Each varItem In List8.ItemsSelected
        StrSQL = StrSQL + "[" & List8.ItemData(varItem) & "] = " & InputBox("Please Specify " & List8.ItemData(varItem) & " :") & " AND "
Next varItem
 
I'm being a bit cheeky replying here as I've never done this but I strongly suggest that it will request the input each time round the loop and what you need to do is request the input prior to the loop and then use the stored input in the loop.

Brian
 
Well the loop is asking for a different piece of information each time depending on what is selected on the list. The problem is only happening when it runs the report with the newly created SQL string which is being created properly i think.
 
think I might have found the problem but not sure of the solution. How do you put " into code without it thinking it is about to use a quote? The SQL that is generated doesn't have any "" in which i think it needs to, but how do I put it in?
 

Users who are viewing this thread

Back
Top Bottom