473,326 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

VB2005- how to manage multiple checkbox result

9
Hi.

How do I insert in a db multiple checkbox results? I have 11 checkboxes, so how to do it in one query? Please :P
Dec 30 '07 #1
16 3104
Killer42
8,435 Expert 8TB
If you give us some idea of how you're interfacing with the database now, to handle a single value, I'm sure we can help you extend it to store multiple values.
Dec 31 '07 #2
yaad
3
If you want to use multiple check boxes then first be sure you are using a control array. After that while inserting data take this reference.

If you have 11 controls then

Let check box name be check1
Expand|Select|Wrap|Line Numbers
  1. For I = 0 To 10
  2.   STRA = STRA & "'" & Check1(I).Caption & "'" & ","
  3. Next
  4. STRA = Mid(STRA, 1, Len(STRA) - 1)
  5. STRSQL = "INSERT INTO TABLENAME VALUES('RAM','SHYAM'," & STRA & ")"
  6.  
  7. CN.Execute STRSQL
That’s it.
If you need more, contact me on <Removed by Moderator>
Dec 31 '07 #3
Killer42
8,435 Expert 8TB
Thanks for that, yaad.

But please don't post your e-mail address (or anyone else's) in the forum. This is for your protection, from scammers and spammers who may scan the list. If people need to contact you privately, they can send you a private message, or "PM" by clicking on your ID to get to your profile. You can then exchange details privately.

Also, please don't SHOUT when responding to a question. I have converted most of the ALL UPPER CASE TEXT to mixed (or "sentence") case.
Dec 31 '07 #4
Killer42
8,435 Expert 8TB
Oh, and one more thing. Control arrays were removed after VB6. They're not available in VB 2005. I wish I knew why, as they are an extremely useful feature.
Dec 31 '07 #5
manius
9
Control arrays were removed after VB6. >> okay cause I learned 2005 and I don't know what control arrays are :( . You said to show you how my database is? Well I have one table with 2 text fields, 11 checkboxes and 1 datetime field. All of that I should fill with one button click. In text box I enter the name, I select the date and check specific checkbox so I enter the name, date and value for some of the 11 check box like true.
Dec 31 '07 #6
manius
9
i decide to insert values of all checkboxes at once into table with yes/no field. the questione is how code looks for checkbox control:
"checbox.________???"
Dec 31 '07 #7
Killer42
8,435 Expert 8TB
... questione is how code looks for checkbox control:
"checbox.________???"
Not sure what code you mean. Do you mean how to insert a checkbox value into SQL to go into a Yes/No field? If so, that's probably quite version-specific. In VB6, I would use the Format() function to format the boolean value as "YES" or "NO".
Jan 1 '08 #8
manius
9
so bad im new so probably i not good explaining, look, i have checkbox on my form, and i want save the users choice or selection, or that checked unchecked value of the checkbox into access database into yes/no table field. it should be quite simple, something like "checbox.checked" or i dont know????:(
Jan 1 '08 #9
manius
9
Dim sql As String = "insert into dnEvidencija (elektroth) values"
& "("+cbElektro.Checked + ")"

this is how it looks in code, it not vorking :(
Jan 2 '08 #10
Torgg
41
This should do it for you

Expand|Select|Wrap|Line Numbers
  1.             Dim sql As String = "INSERT INTO dnEvidencija " & _
  2.               "(Field_One, Field_Two, Field_Three, Field_Four, Field_Five) Values (" & CheckBox1.Checked & "," & CheckBox2.Checked & "," & CheckBox3.Checked & "," & CheckBox4.Checked & "," & CheckBox5.Checked & ");"

Hope this helps,
Torgg
Jan 2 '08 #11
Killer42
8,435 Expert 8TB
Just out of curiosity, what do you actually get when you assign the Checked property to a string?
Jan 3 '08 #12
manius
9
Conversion from string "(" to type 'Double' is not valid.
Jan 3 '08 #13
Torgg
41
Conversion from string "(" to type 'Double' is not valid.
You'll need to post more information then this. Are you getting an error from the code I posted (I tested it and it worked fine)? Did you copy and paste what I posted (just to have a base line of working code)? Please post the modified SQL query you’re having trouble with.

Torgg
Jan 3 '08 #14
Killer42
8,435 Expert 8TB
Conversion from string "(" to type 'Double' is not valid.
This can't be in response to what I asked, because that was about converting to a string, not from.
Jan 3 '08 #15
manius
9
Torgg you the king! Your code works, he now i can go on with my app development, he sound seriosly, he thanks killer to, it works just fine, isert work, great, you make my day, thanks, manius
Jan 4 '08 #16
Killer42
8,435 Expert 8TB
Glad we could help out. :)
Jan 5 '08 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Chris Devol | last post by:
My dial-up connection sometimes hangs up and has to re-connect. The VB2005 installer/downloader apparently doesn't know how to resume when the connection is re-established. It just aborts! I've...
3
by: Diarmuid | last post by:
I have the MS book, introducing Microsoft Visual Basic 2005 for Developers. No sample code comes with it.The location according to the book is http://msdn.microsoft.com/vbasic/VB6Migration but I...
2
by: Jerry Spence1 | last post by:
1. Is there a more suitable, dedicated newsfeed for VB2005 yet? 2. I'm confused as to which version to get. I work for a small company and we will just need VB2005 on my PC. Therefore that tends...
1
by: Galen Somerville | last post by:
I uninstalled and reinstalled VB6. When I have an unhandled exception in VB6, it uses the VB2005 Pro debugger. There is no way to leave the VB2005 debugger without ending up at the desktop. How...
0
by: Rich | last post by:
Hello, I just upgraded a vb2003 app to vb2005. The vb2003 app had/has a statusbar object - which contains panels and I can see the properties of the statusbar in the properties window in...
2
by: Omar Abid | last post by:
Hi, This the best site where you can find Hi members, We are happy to tell that if you search for : jobs with high wage or to debug a program or to find a good source code and to make a good...
1
by: erickwan88 | last post by:
I am doing a final year project for my school and is going to provide for an organization, so I am asking for some help on here. Indeed, I have no idea on how to get the input from my pen driver...
15
by: Aalaan | last post by:
I am presently a user of classic vb6 and hang out on those newsgroups. Some of you may be aware that there is a very anti MS and vb2005 feeling there. I have tried to get them to tell me which...
1
by: Jeffrey Christiansen | last post by:
I wanted to add a toggle button to a VB2005 form to be used for a simple Windows Application (i.e. compiled to a "*.exe"), so I added the ActiveX Microsoft Forms Object toggle button, however I...
1
by: Vae07 | last post by:
Ok so here is a brief summary of my problem. I need a pop up form that submits input text box information to a pocket excel workbook upon a command botton click. Text box inputs are checked for...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.