How to use option buttons

How do I search using option buttons? I want the option
button so the user can choose to search the database
either by account number or fund number. How do I link
the search to the option button?
dgoldsbyAsked:
Who is Participating?
 
hhammashConnect With a Mentor Commented:
Hi,

Are you using FrontPage and Access?

DRW is Database Results Wizard.  It is when you select Insert/Database Results in FrontPage.  

Anyway I've got a solution and I tried it.  It is working fine.

Create the search form
(Change the names in my example to suite your needs)
----------------------------------------------------
1- Create the search form that has a- Textbox, b- A radio button, c- A radio button.  Now you have 1 Textbox and 2 Radio buttons.

Double click the Textbox and Name it FindNumber

Double click the first Radio and name the group as SelectText. In the value put the name of the page that will display the results by Account Number. (In my example is ByNumber.asp)

Double click the second Radion and name the group as SelectText. In the value put the name of the page that will display the results by Fund number. (In my example is ByFund.asp)

Now Save the form as Search.asp

Now create a new page and call it PointRight.asp and save it.

Go to HTML view of PointRight.asp and erase all what you see,  then post the following code.

<%
DIM MyPage,MyNumber
MyNumber=request.form("FindNumber")
MyPage=Request.form("SelectText")
MyURL=MyPage
Myvarq="?"
MyVar="FindNumber="
MyVal=MyNumber
response.redirect MyPage+Myvarq+Myvar+Myval
%>

Save the page.

Now the SQL of the Result pages:

ByNumber:
---------
SELECT * FROM Accounts WHERE (AccountNumber =  ::FindNumber::)

By Fund:
--------
SELECT * FROM Accounts WHERE (FundNumber =  ::FindNumber::)

Accounts is the name of my table
Account Number is the AccountNumber field
Fund Number is the FundNumber field

The ByNumber SQL will receive the criteria from PointRight.asp and looks by AccountNumber. The ByFund.asp SQL will receive the criteria from the PointRight.asp and looks by FundNumber.

So the user has one search field, he/she can put whatever he/she remembers.

Hope this is what you need.

Let me know if you need more clarification.

hhammash


0
 
hhammashCommented:
Hi,

It can be done, no problem.

I would like to know more. Do you have 1 search form and 2 DRWs.

I mean if you search by account number then submit ths form it opens a DRW,  but if you search by fund number another DRW opens,  is that right?

hhammash
0
 
dgoldsbyAuthor Commented:
I'm not sure what a DRW is. I have 1 search form. This database has about 7 columns. I need to be able search the database using any 4 of those columns. The person may only know the account number or the org number therefore they can only search using that information. The same table with the same 7 columns will be displayed no matter which search option the person uses. Does this help?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
hhammashCommented:
Hi,

I forgot to mention:

Post your search form to PointRight.asp

Right Click the form
select Properties
Send to Other
Options
In the Action field put PointRight.asp
Press Ok
Press Ok

Regards
hhammash
0
 
hhammashCommented:
Hi again,

I have a much simpler solution.

Create a form with 1 Textfield only.  Name the text field as FindNumber. Then post your form to the results page.

In the action of the form properties put Results.asp

save the form as Search.asp

Now in the SQL of your Results.asp page put the following:

SELECT * FROM Accounts WHERE (AccountNumber =  ::FindNumber:: OR FundNumber =  ::FindNumber::)

So no matter what they put in the search field either Account number of fund number.  The search result will find it.

Best regards
hhammash
0
 
dgoldsbyAuthor Commented:
Oh Thank You sooooo much!!:)  It worked!  I've been working on this for so long.  I appreciate it.
0
 
hhammashCommented:
You are most welcome dgoldsby

My best regards
hhammash
0
 
dgoldsbyAuthor Commented:
Oh Thank You sooooo much!!:)  It worked!  I've been working on this for so long.  I appreciate it.
0
 
hhammashCommented:
Which solution did you like accept?

The first or the second.

Thanks a lot
hhammash
0
 
dgoldsbyAuthor Commented:
I went with the first solution but i have another question.  What do i do if i want two different groups of radio buttons?  In this database there are 3 different tables. I need to be able to search the same way as above but the user can select from which table they want to search. So i have 2 sets of radio buttons. One set selects which table to search from and the other set selects how you want to search.
0
 
hhammashCommented:
Hi,
The select which table to search from is settled,  but what do you mean by "how you want to search"?

Thanks
hhammash
0
 
dgoldsbyAuthor Commented:
When I say "how you want to search" I mean search using either the account number or fund number. I need to have the option to select which table i want to search from and then select to search by account number or fund number. I need to use option buttons for all of the above.
0
 
hhammashCommented:
Ok,

That can be arranged,  I will post it for you tomorrow morning.

hhammash
0
All Courses

From novice to tech pro — start learning today.