By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

checkbox values

lee123
100+
P: 556
i have on a form customers information and i have added a checkbox to the form to make visible these textboxes if additional information is needed for the customer.

question:

how do i make it if a customer needs the checkbox clicked the textboxes will show for only that customer and not all. you see i have an adodc control on the form that gets the information for the other textboxes with access (2000) for the backend. i have put buttons on the form to scroll through the records without using the adodc (which i have made invisible on the form) so when scroll through the records only the ones that have the checkbox checked should show and not all the records i hope i have made sense

I'm using Visual basic 6.0

thanks,
lee123
Jan 15 '08 #1
Share this Question
Share on Google+
9 Replies


Dököll
Expert 100+
P: 2,364
i have on a form customers information and i have added a checkbox to the form to make visible these textboxes if additional information is needed for the customer.

question:

how do i make it if a customer needs the checkbox clicked the textboxes will show for only that customer and not all. you see i have an adodc control on the form that gets the information for the other textboxes with access (2000) for the backend. i have put buttons on the form to scroll through the records without using the adodc (which i have made invisible on the form) so when scroll through the records only the ones that have the checkbox checked should show and not all the records i hope i have made sense

I'm using Visual basic 6.0

thanks,
lee123
Hello, lee123!

Just passing through making sure your post is not uinanswered, time zones that whole deal...

Unfortunately, I have a piece of code that queries using the like operator, but the idea is you'd need to add that customer's name to the textbox on the VB form then hit submit, the recordset, ADODC1 recordset, would get filled with only that customer's data, which you can page through.

I am still learning VB, I am not sure how to mastermind this into checkboxes. You let me, I 'll tell you what to do, guide you through.

Anything you have working by the way can be added for a closer by our experts here, may help shed some light:-)

In a bit!
Jan 15 '08 #2

Dököll
Expert 100+
P: 2,364
Hello, lee123!

Just passing through making sure your post is not uinanswered, time zones that whole deal...

Unfortunately, I have a piece of code that queries using the like operator, but the idea is you'd need to add that customer's name to the textbox on the VB form then hit submit, the recordset, ADODC1 recordset, would get filled with only that customer's data, which you can page through.

I am still learning VB, I am not sure how to mastermind this into checkboxes. You let me, I 'll tell you what to do, guide you through.

Anything you have working by the way can be added for a closer by our experts here, may help shed some light:-)

In a bit!
I was thinking lee123, perhaps your checkboxes can act as your submit button, get it. If we add the code under the checkbox and not the submit button, you would in fact be querying for that customer.

I may be way off:-)
Jan 15 '08 #3

Expert 5K+
P: 8,434
If I'm reading the question correctly, you just want the textboxes to appear or disappear automatically as you scroll through the records, based on the value of a field (which is displayed as a checkbox).

You should be able to do so by coding in the appropriate event procedure on the data control. Not sure exactly which event, though. I seem to recall there are ones which are fired when you move between records, before/after the record is displayed, and so on. I may be getting mixed up with forms in MS Access, though. I do know the built-in data control has a Reposition event.

Another alternative might be to just watch for a change in the value of the checkbox - either by using an event procedure of the control, or a timer.
Jan 15 '08 #4

lee123
100+
P: 556
Hey killer42 & Dokoll:

thanks for getting back with me you two. but killer42 you have hit the nail on the head (sorta speak) i have put a code in the form_load because in access i think you have to do this and put the code in the checkbox also. but i tried in my form (vb) but when i scrolled through the records the checkbox was checked on all and not just the ones i have checked but i'll try this what you have stated. i'll get back with you and tell you if it worked or not.

thanks,
lee123
Jan 15 '08 #5

lee123
100+
P: 556
oh just so you have an idea what i have in the checkbox here it is:

Expand|Select|Wrap|Line Numbers
  1.  If Check2.Value Then
  2.         txtVehicle2.Visible = True
  3.         txtVehicle3.Visible = True
  4.         Label21.Visible = True
  5.         Label22.Visible = True
  6.         Label17.Visible = True
  7.         txtHowManyVeh.Visible = True
  8. Else           
  9.         txtVehicle2.Visible = False
  10.         txtVehicle3.Visible = False
  11.         txtHowManyVeh.Visible = False
  12.         Label21.Visible = False
  13.         Label22.Visible = False
  14.         Label17.Visible = False
  15.     End If
Thanks,
lee123
Jan 15 '08 #6

lotus18
100+
P: 866
oh just so you have an idea what i have in the checkbox here it is:

Expand|Select|Wrap|Line Numbers
  1.  If Check2.Value Then
  2.         txtVehicle2.Visible = True
  3.         txtVehicle3.Visible = True
  4.         Label21.Visible = True
  5.         Label22.Visible = True
  6.         Label17.Visible = True
  7.         txtHowManyVeh.Visible = True
  8. Else           
  9.         txtVehicle2.Visible = False
  10.         txtVehicle3.Visible = False
  11.         txtHowManyVeh.Visible = False
  12.         Label21.Visible = False
  13.         Label22.Visible = False
  14.         Label17.Visible = False
  15.     End If
Thanks,
lee123
Hey You had forgotten to add value to a checkbox. Minimizing the codes:

Expand|Select|Wrap|Line Numbers
  1. Public Sub CheckValue(a As Boolean)
  2.       txtVehicle2.Visible = a
  3.       txtVehicle3.Visible = a
  4.       txtHowManyVeh.Visible = a
  5.       Label21.Visible = a
  6.       Label22.Visible = a
  7.       Label17.Visible = a
  8. End Sub
  9.  
  10. If Check2.Value=1 Then
  11.     CheckValue True
  12. Else
  13.     CheckValue False
  14. End If
  15.  
Rey Sean
Jan 15 '08 #7

Expert 5K+
P: 8,434
Oh, so we want to minimise code, do we? :) Well, I'll take that challenge.

Without changing your CheckValue sub...
Expand|Select|Wrap|Line Numbers
  1. CheckValue (Check2 <> 0)
Jan 15 '08 #8

Expert 5K+
P: 8,434
lee123, anything you put in the Form_Load event procedure will only be executed once, when the form is loaded. You need to use an event which will occur at the point you are interested in . That is, when you change records.
Jan 15 '08 #9

daniel aristidou
100+
P: 491
lee123, anything you put in the Form_Load event procedure will only be executed once, when the form is loaded. You need to use an event which will occur at the point you are interested in . That is, when you change records.
Could you not use the textbox.textchanaged event on the textbox containing the primary key........ wait im not sure whether that is vb6..,,,
Jan 16 '08 #10

Post your reply

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