Option Box/Check Box design

nik707

New member
Local time
Yesterday, 22:55
Joined
May 22, 2008
Messages
9
Hello,

I am fairly new to access designing.

I have a function that starts like this

Code:
Public Function GetResults(strPassed As String, blnExactMatch As Boolean) As String

Now the blnExactMatch carries True/False.

However, when I try to design two option boxes (1 which will carry true and other one carrying false) I do not know how to relate them both. I also want them to be only one can be selected at one point and one of them must be selected at any point (including the VB code and the properties needs to be assigned)

Is there any tutorials available for this (I did few searches and found nothing close)


Any help is much appreciated!! Thank you for your time and expertise :)
 
Why not just use a checkbox/radio button? It has 2 states built in, true and false. Checked is true, unchecked is false.
 
Why not just use a checkbox/radio button? It has 2 states built in, true and false. Checked is true, unchecked is false.


Thanks! But could you please let me know how to call them out?

Eg, in a case statement (from the look of it, is it like this?)
Code:
Dim blnExactMatch As Boolean

If IsNull(optSearch) Then
    MsgBox "You must select one of the option boxes to define your search!"

'I assigned 0 as the first option number and 1 for the next one

Else
Select Case Me!optSearch

Case 0
blnExactMatch = true

Case 1
blnExactMatch = false
End If

Would that work? Thanks (I don't have access in the current computer but I am planning to do this when I get home!)


Thanks again for your efforts and time!
 
Like I said, it only has 2 states:

Code:
blnExactMatch = Me!chkSearch

Or, don't waste your time with the blnExactMatch and just use the value from the check box where you'd normally use the bln.
 
Or if you absolutely want two option buttons, use an option group (looks like a frame on the control list) and assign it radio buttons during the wizard process. Then, you can also use this code as a boolean match (if option 1 is Yes and option 2 is No):

blnExactMatch = (Me.fraYourFrameName=1)
 
Or if you absolutely want two option buttons, use an option group (looks like a frame on the control list) and assign it radio buttons during the wizard process. Then, you can also use this code as a boolean match (if option 1 is Yes and option 2 is No):

blnExactMatch = (Me.fraYourFrameName=1)

26420529pe8.png


Thats what I have on plate. The first option is assigned 0 and next one have 1 assigned to it.

And the whole group frame name is 'optSearch'


blnExactMatch = Me!optSearch

'0 is the first one's assigned number
blnExactMatch = (Me.optSearch=0)

Which one of the above line would return a true or false? I mean if the first box is false that means second one is on...so -.-

Thanks again fellas! ;)
 
Last edited:
This line:

blnExactMatch = (Me.fraYourFrameName=0)


means that if your option frame has a value of zero, then it would be true so then

blnExactMatch = True

if your option group has a value of 1 then Me.fraYourFrameName = 0 would be false so then

blnExactMatch = False
 
This line:

blnExactMatch = (Me.fraYourFrameName=0)


means that if your option frame has a value of zero, then it would be true so then

blnExactMatch = True

if your option group has a value of 1 then Me.fraYourFrameName = 0 would be false so then

blnExactMatch = False

Thanks alot! That cleared up alot. Learned a bit of VB back in grade 10 but then its all about C and Java so I don't know how comparisons are done nor how values are called out in VBA.

Thanks again and cheers (for now till I come up with another problem lol)

Have a nice day! :D
 

Users who are viewing this thread

Back
Top Bottom