Checkbox on database

Reply

Join Date: Jul 2007
Posts: 23
Reputation: mustoora is an unknown quantity at this point 
Solved Threads: 0
mustoora mustoora is offline Offline
Newbie Poster

Checkbox on database

 
0
  #1
Oct 8th, 2007
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?

  1.  
  2. If vibrotactile = False Then
  3. 'Case 1
  4. acTestEarThreshold = acTestEarThreshold
  5. End If
  6.  
  7. If vibrotactile = True Then
  8. 'Case 2
  9. If acTestEarThreshold <= 20 Then
  10. acTestEarThreshold = acTestEarThreshold
  11.  
  12. ElseIf acTestEarThreshold > 20 Then
  13. acTestEarThreshold = 20
  14. End If
  15. End If
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 26
Reputation: shikeb is an unknown quantity at this point 
Solved Threads: 0
shikeb's Avatar
shikeb shikeb is offline Offline
Light Poster

Re: Checkbox on database

 
0
  #2
Oct 9th, 2007
Originally Posted by mustoora View Post
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?

  1.  
  2. If vibrotactile = False Then
  3. 'Case 1
  4. acTestEarThreshold = acTestEarThreshold
  5. End If
  6.  
  7. If vibrotactile = True Then
  8. 'Case 2
  9. If acTestEarThreshold <= 20 Then
  10. acTestEarThreshold = acTestEarThreshold
  11.  
  12. ElseIf acTestEarThreshold > 20 Then
  13. acTestEarThreshold = 20
  14. End If
  15. 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.
Regards,
Shikeb Ali
------------------------------------------
“Beware the fury of a patient man.”
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 85
Reputation: williamrojas78 is an unknown quantity at this point 
Solved Threads: 4
williamrojas78's Avatar
williamrojas78 williamrojas78 is offline Offline
Junior Poster in Training

Re: Checkbox on database

 
0
  #3
Oct 9th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 23
Reputation: mustoora is an unknown quantity at this point 
Solved Threads: 0
mustoora mustoora is offline Offline
Newbie Poster

Re: Checkbox on database

 
0
  #4
Oct 10th, 2007
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'.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 26
Reputation: shikeb is an unknown quantity at this point 
Solved Threads: 0
shikeb's Avatar
shikeb shikeb is offline Offline
Light Poster

Re: Checkbox on database

 
0
  #5
Oct 10th, 2007
Hi,

have ya tried to convert it to boolean ... because the True false property of CheckBox only works in that condition.
Regards,
Shikeb Ali
------------------------------------------
“Beware the fury of a patient man.”
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 26
Reputation: shikeb is an unknown quantity at this point 
Solved Threads: 0
shikeb's Avatar
shikeb shikeb is offline Offline
Light Poster

Re: Checkbox on database

 
0
  #6
Oct 10th, 2007
Hi again,
fortunately I managed to run it ... but i did it in C#, its like this,

  1. if (vibrotactile.myCheckBox.Checked == false)
  2. {
  3. acTestEarThreshold = acTestEarThreshold;
  4. }
  5. else
  6. {
  7. If (acTestEarThreshold <= 20)
  8. {
  9. acTestEarThreshold = acTestEarThreshold;
  10. }
  11. else
  12. {
  13. acTestEarThreshold = 20;
  14. }
  15.  
  16. }

It was working fine.
I Hope you'll get something out from it and that it'll work for you.
Regards,
Shikeb Ali
------------------------------------------
“Beware the fury of a patient man.”
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 23
Reputation: mustoora is an unknown quantity at this point 
Solved Threads: 0
mustoora mustoora is offline Offline
Newbie Poster

Re: Checkbox on database

 
0
  #7
Oct 18th, 2007
Hi

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


  1. If vibrotactile Then
  2. 'Case 2
  3. If acTestEarThreshold <= 20 Then
  4. acTestEarThreshold = acTestEarThreshold
  5.  
  6. ElseIf acTestEarThreshold > 20 Then
  7. acTestEarThreshold = 20
  8. End If
  9.  
  10. Else
  11. 'Case 1
  12. acTestEarThreshold = acTestEarThreshold
  13. End If
  14.  
  15. End If
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2655 | Replies: 6
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC