Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > Data type Yes/No
 

Data type Yes/No

Hi

I have a column in my Access database called 'VT', with a data type of Yes/No. The column contain checkboxes.

Code Block

vibrotactile = ds.Tables("maskingSimulator").Rows(s).Item("VT")


I stored the values in a variable called 'vibrotactile' and declare vibrotactile as Boolean. If my VT column is not checked, it will carry out Case 1. Else, if my VT column is checked, it will carry out Case 2. How do i put it into codes? I tried to put 'if vibrotactile = false' and 'if vibrotactile = true'. But it doesn't seem to work. How do i go about it? Should vibrotactile be declared as boolean?

Code Block

If vibrotactile = False Then
'Case 1
acTestEarThreshold = acTestEarThreshold
End If

If vibrotactile = True Then
'Case 2
If acTestEarThreshold <= 20 Then
acTestEarThreshold = acTestEarThreshold
ElseIf acTestEarThreshold > 20 Then
acTestEarThreshold = 20
End If
End If


VBbeginenr  Thursday, October 11, 2007 12:09 PM
Code Block

 If vibrotactile Then

'Case 2

      If acTestEarThreshold <= 20 Then
acTestEarThreshold = acTestEarThreshold
ElseIf acTestEarThreshold > 20 Then
acTestEarThreshold = 20
End If

Else

'Case 1

      acTestEarThreshold = acTestEarThreshold
End If


Lee_Dale  Thursday, October 11, 2007 12:33 PM
This is probably caused by an old VB6 anachronism. The Access Yes/No column type defines 0 as No and -1 as Yes. Yes, declare vibrotactile as a boolean and assign it like this:

vibrotactile = 0 <> ds.Tables("maskingSimulator").Rows(s).Item("VT")
nobugz  Thursday, October 11, 2007 2:03 PM
Code Block

 If vibrotactile Then

'Case 2

      If acTestEarThreshold <= 20 Then
acTestEarThreshold = acTestEarThreshold
ElseIf acTestEarThreshold > 20 Then
acTestEarThreshold = 20
End If

Else

'Case 1

      acTestEarThreshold = acTestEarThreshold
End If


Lee_Dale  Thursday, October 11, 2007 12:33 PM
This is probably caused by an old VB6 anachronism. The Access Yes/No column type defines 0 as No and -1 as Yes. Yes, declare vibrotactile as a boolean and assign it like this:

vibrotactile = 0 <> ds.Tables("maskingSimulator").Rows(s).Item("VT")
nobugz  Thursday, October 11, 2007 2:03 PM

You can use google to search for other answers

Custom Search

More Threads

• Could not load file or assembly ?
• invalidate UserControl
• How would you iterate the entire REGISTRY please?
• Displaying the version number
• Invalid Database File Header
• Creating a menu when my application is executing !!!
• [OTP]VB 3 Illegal Function Call Error
• Writeline problem
• Assembly Version not Updating changes from AssemblyInfo.vb
• reading my.settings