arhayes

Syntax for using InputBox input in a whereclause?

Discussion created by arhayes on Aug 13, 2011
Latest reply on Aug 13, 2011 by Grieck
I have some code where I want to use an InputBox to allow the user to specify the value used in a whereclause, but after 4 hours of searching I cannot figure out the proper syntax.  Obviously I am a beginner.  Any assistance would be greatly appreciated!

My Inputbox code would be similar to the following:

Dim strArea As String
strArea = InputBox("Area greater than", "Area", "5000")

Dim strDistance As String
strDistance = InputBox("Distance greater than", "Distance", "50")

And this would be my whereclause:

Dim pQueryFilter As IQueryFilter
        pQueryFilter = New QueryFilter
        pQueryFilter.WhereClause = "AREA> AND DISTANCE>" 

How do I add the strArea and strDistance to this whereclause? 

Do I need to convert them first to type "double", using something like:  

Dim dubArea As Double
dubArea = Convert.ToDouble(strArea)

Dim dubDistance As Double
dubDistance = Convert.ToDouble(strDistance)

If so, how would I then add the dubArea and dubDistance to my whereclause? 

What if I also wanted to have the user specify the >,<, =, etc. using separate Inputbox's?  How would I also add that to the whereclause. 

Thanks again!

Outcomes