Hi there

I'm now using Microsoft Access and i have a column called VT. I stored it into a variable called vibrotactile. vibrotactile = ds.Tables("maskingSimulator").Rows(s).Item("VT") The problem is the column contains checkboxes. 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?

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

Hi there

I'm now using Microsoft Access and i have a column called VT. I stored it into a variable called vibrotactile. vibrotactile = ds.Tables("maskingSimulator").Rows(s).Item("VT") The problem is the column contains checkboxes. 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?

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

You haven't mentioned or used the checkbox any where in your code. Any ways, Your check box may got some other ID but Im using here yourCheckBox as an ID.

So Now,

If vibrotactile.yourCheckBox.checked = False Then
'Case 1
acTestEarThreshold = acTestEarThreshold
End If

If vibrotactile.yourCheckBox.checked = True Then
'Case 2
If acTestEarThreshold <= 20 Then
acTestEarThreshold = acTestEarThreshold

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

I Hope it'll work.

Hi

What is the type of column "VT"; if it is not of type "bit" probably the FALSE - TRUE statements won't work. Otherwise it should work.

I make the same evaluation but i use a dataview instead and it works fine, but I don't see any reason it would not work with the table directly.

Hi

thanks for replying. I tried putting the checkbox ID but it doesn't work. Wriggly lines appeared. It says 'VT is not a member of string'. I declared 'vibrotactile' as String. Is it correct?

I checked the properties of my 'VT' column. The data type states that 'Yes/No'.

Hi,

have ya tried to convert it to boolean ... because the True false property of CheckBox only works in that condition.

Hi again,
fortunately I managed to run it ... but i did it in C#, its like this,

if (vibrotactile.myCheckBox.Checked == false)
      {
             acTestEarThreshold = acTestEarThreshold;
       }
else 
      {
        If (acTestEarThreshold <= 20)
                       {
                         acTestEarThreshold = acTestEarThreshold;
                        }  
       else
                        {                   
                         acTestEarThreshold = 20;
                         }

       }

It was working fine.
I Hope you'll get something out from it and that it'll work for you.

Hi

thanks for the help. Really appreciate it. I've managed to get it out. Here's what i did to it

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

         End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.