How can I add date range to code below?

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 10 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How can I add date range to code below?

Post by jvierra »

I will give you a push in the right direction.

#1 - do not use forms as they make an HTA harder to manage.
#2 - d not use events to assign values that are selective and additive.

#3 - TRy to describe what you want as an outcome without saying how you want to do it. Remember that you are the one asking for help. Tell us what and not how. YOu are asking for us to show you how.

Now go back and describe what you want to do.
User avatar
ihechi
Posts: 7
Last visit: Thu Apr 04, 2013 1:46 pm

Re: How can I add date range to code below?

Post by ihechi »

I have this radio button called ANDOR where the values can either be AND or OR.

Code: Select all

<input name="ANDOR" id="ANDOR" type=radio checked value="AND"> Match all
<input name="ANDOR" id="ANDOR" type=radio value="OR"> Match any
I want to use the ANDOR in my query where clause.

Example:

Code: Select all

 ' and now build up the WHERE:
 where = ""
Then I would like to use it like:

Code: Select all

    txtsrch = txtsrch.value
    If txtsrch <> "" Then
        If where <> "" Then where = where & AndOr
        where = where & " txtsrch = '" & Replace(txtsrch ,"'","''") & "'"
    End If
But I am getting "Object doesn't support this property "ANDOR.Value"

Thanks for your help.

I hope I have explained what I am trying to do.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How can I add date range to code below?

Post by jvierra »

I think you do not understand. Don't say how you are trying to do this. Without mentioning buttons or script explain what it is you are trying to do.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How can I add date range to code below?

Post by jvierra »

It appears that you are trying to build a query designer. This is a huge undertaking in VBScript.

I have built many of these in the past usijng C++ and C# and I think you are going to need to spend some time learning how to use DHTML.

You have an issue here. YOu want to add AND or OR to your query but what happens if you don't want either.

The way I have done this is th build logic sets that can be parsed and displayed as SQL. What we are doing is determining the elements of a filter. Filters are = != > < <= >=. Logical connectives are AND OR NOT. YOu need to build a casceded display of the two of these and then add back the conenctives. Doing this in sucha a way as to allow the screen to show what is aceptable and to eneble/disable boxes or buttons takes some thinking.

I still cannot determine what this has to do with adding a date range. TO add a date range you just need to add to dates to the form and copy them into the query.
User avatar
ihechi
Posts: 7
Last visit: Thu Apr 04, 2013 1:46 pm

Re: How can I add date range to code below?

Post by ihechi »

Hi,

Ok, let me try to explain agaiin.

In my original post of a few days ago, I stated that we have an app with a search functionality below that works great.

SQL_query = "SELECT typeofdocument, btyp, bkno, disp, dispdt, PGNO FROM myTable NAME '" & Replace(txtsrch,"'","''") & "' ORDER BY NAME "

Now, the users wanted to add date range so that they either search by current search param OR by date range.

So, users will have a box to search by txtsrch and if they don't want to search by that only, they could search by date range.

That's why I posted here in the first place.

Now, I have figured out a way to search by date range but I want to give the users the option to search by one or the other or both, hence the ANDOR.

I have used this ANDOR before in asp/vbscript before and I stated this earlier.

I am just looking for a way to convert this line:

AndOr = Request("ANDOR") to .hta so that instead of request("ANDOR"), it could be something like:

AndOr = ANDOR.Value but this doesn't work.

That's all I need help on.

I hope this is clearer now.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How can I add date range to code below?

Post by jvierra »

Are you just asking how to get the value of a radio button?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How can I add date range to code below?

Post by jvierra »

Routing in my junk box I found this which shows how to use radio buttons. Place it in an hta and run.
VBScript Code
Double-click the code block to select all.
<html>
<head>
	<title>Test</title>
	<HTA:Application
		applicationName = "Test"
		ID = "html_hta"/>
	<script type="text/vbscript">
          Sub window_onload()
             
		     'msgbox "VBSCRIPT:" & html_hta.applicationName
          End Sub
          Sub test()
              for each b in rb1
              if b.checked Then msgbox b.Value
              next
          End Sub
	</script>

</head>

   <input type="button" Value="CLick Me" onclick="test"/>
   
   <input type="radio" name="RB1" Value="1" />
   <input type="radio" name="RB1" Value="2" />
   <input type="radio" name="RB1" Value="3" />
</body>
</html>
This topic is 10 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked