473,320 Members | 2,124 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,320 software developers and data experts.

Automatically increase checkboxes depending on data

89
Hi all,
I have a problem with checkbox. I have a database where i will get specific rows depending on user input, I dont know how many rows will select. I need to display rows on user end and which will appear with beside checkboc where user can select their desire rows. My problem is how to increase checkbox and how mention their name? I have no idea about increasing check box depend on loop, I mean such as,

dim Rs as Recordset
Con.open"select Name from Emp where sal>2000"
Do Until Rs.EOF

I want to show checkbox here , autometically appear on Form
Rs.MoveNext
Loop
Thx advance my all friends, Shaiful
Dec 23 '07 #1
4 1607
debasisdas
8,127 Expert 4TB
Why don't you use listbox instead.

But if you want to still use checkbox ,create one at designtime as control array and use count to findout the number of records.
Create the checkboxes by increasing the index at runtime and add the data to the caption of the checkbox control
Dec 24 '07 #2
Hi,

You can go for a control array.
For ex.

Steps

1. Place one checkbox control on your form
2. Give appropriate name to your checkbox control - chkBox

To work with control array you need to set index property of control
3. Set index property to Zero (0)
4. Find total no. of rows retrieved from your table. For ex. RecCount = 10 rows
5. Use loop
Expand|Select|Wrap|Line Numbers
  1. For i = 0 To RecCount
  2.     If i = 0 Then
  3.         chkBox(i).Caption = rs!FieldName
  4.     Else
  5.         Load chkBox(i)
  6.         chkBox(i).Top = (chkBox(i-1).Top +  chkBox(i-1).Height) + 20
  7.         chkBox(i).Caption = rs!FieldName
  8.         chkBox(i).Visible = True
  9.     End If
  10. Next
Note : Before creating new CheckBox at runtime check for the existence of the checkbox, if it is then remove first then again recreate.
To unload:
Unload chkBox(i)

You can not unload the control created at design time i.e. chkBox(0)
Dec 24 '07 #3
Ali Rizwan
925 512MB
I have a problem with checkbox ...
Use the code provided but I think create all the checkboxes at runtime neither in design time.
I mean one you will create in design not here but create it also in runtime.
Using the way I have told you on Yahoo!.
Else if you have also an error in this code mail me.

Regards.

>> ALI <<
Dec 24 '07 #4
shaiful
89
Hi, its work great in vb6. Actually i am working with VBA in there no index property i can set, in that case how i solve this problem? Thx again.
Dec 26 '07 #5

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

Similar topics

1
by: wolfing1 | last post by:
I'd like to have an 'approve' and 'reject' option for each record in a list, and a 'process' button. When this button it's pressed, then it would post to the same page which would update (or add)...
1
by: Mohan | last post by:
Hi, In my application, I need to increase the 2-dimensional array size dynamically. Please let me know the procedure to declare a dynamic 2-dimensional array like Single dimensional array,...
2
by: dad | last post by:
I need help writing a query to display all boxes that are checked for a particular record. I have ten possible check boxes for each record and each record will have different boxes checked. Any...
2
by: GustavoBrust | last post by:
Hello everyone. I'm having a problem with a search I want to make. It's like this: The user can choose about 15 checkboxes to be his search pattern. According to the combination of...
0
by: TarekSaad | last post by:
I am using VB2005 and have created a dynamic list of checkboxes and depending on which file the user selects there may be between 1 and 20 checkboxed that appear in a form. The user then checks...
3
by: workingstiff19 | last post by:
First, I'm glad to find a newsgroup that still uses a FAQ: http://www.htmlhelp.com/faq The challenge: These checkboxes (inside a table data TD tag) came out too squeezed together (vertically)...
1
by: tamari | last post by:
I have a strange problem changing the checked value of dynamically created checkboxes within code. This is what is happening. Depending what is selected I create checkboxes within a panel. These...
2
by: leifstarkey | last post by:
Hi all... My problem is I'm trying to make a form containing radio buttons and checkboxes. But on the event that one of the radio buttons is selected i want specific checkboxes to then be...
2
by: ebo2006 | last post by:
In the form there 16 checkboxes for types of errors a user can choose from depending on the number of errors found in one account entry. I believe putting 16 corresponding checkbox fields in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: 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...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.