Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making an option button "yes or no"

Status
Not open for further replies.

docliv

Technical User
Nov 11, 2002
21
US
Hi,
Maybe since I'm new at Access, I'm trying to do things different than they should be done, but my beginning application is coming along anyway..My problem is I have a query that runs fine and gets the information I need. What I would like to do (if it can be done) is display the information graphically by using option buttons (making that form will be a trip)...What I would like to do is if there is information in a certain field in my query, I would like the button to have the black dot in it (a yes answer), if the query brings up no data for that particular field or is null, I would like the option button to be a "no".
Seems silly, but this data lends itself to being portrayed on a "grid" and this (I thought) would be one way of doing it. Any Ideas? thanks

Terry
 
Hi Terry,

You could try a simple If...Then statement.

'****begin***
dim rs as DAO.Recordset
dim db as DAO.Database

set db = CurrentDB

set rs = db.OpenrecordSet("query")

If rs.Fields("yourfield") Then
me.optionbutton = True
Else
me.optionbutton = False
end if

set rs = nothing
set db = nothing
'****end*********

I hope this gives you the idea.

Have A Great Day!!!,

Nathan
Senior Test Lead
 
Hi Nathan,
Thanks ever so much for your response. After looking over what I'm trying to do, I'm more lost than ever. My query returns values in a field that are listed vertically, and I would like to represent those values (with an option button on or off) on a grid. This means do some sort of scanning horizontally. I guess I need to know if it is possible to have a horizontal row of 225 items and have a vertical list of like items. Then have a query scan the horizontal and vertical lists and place a true or false value under the horizontal items that could then be used to populate the grid/form. Do you know if this is possible?
I'm probably not making this clear enough, again thanks for your help.

Terry
 
Terry,

For your first time 'round, don't try something so fancy. I don't think it's going to work out, and if it does, it's going to be a LOT of programming.

I think you'll want to use a check box instead of an option button. An option button is for representing something that can be one of several values. A check box is for representing binary states. You can either make the field in the table a yes/no field or you can make one in your query by doing something like this:
NewFieldName: iif([ExistingField] is Null, False, True)

Then you can just put a check box on the form to represent NewFieldName.

Hope this helps.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developers' section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top