p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   Count in combo box(display results in text box) (http://p2p.wrox.com/showthread.php?t=66973)

mboyisis March 28th, 2008 08:42 AM

Count in combo box(display results in text box)
 
Hi!
I have a combobox (Title) that shows the title(i.e. Mr / Mrs / Miss etc .....). I have a text box at the bottom of this to keep track of how many Mr(s),Mrs(s) etc i have selected.i.e. When i select Mr for the first time and enter his details and again for the second time and enter another persons details,it should show in the text box the number 2.Which shows that i have selected the title Mr 2 times..

Pliz help me how tofigure this out in MS Access form.


anukagni March 31st, 2008 05:58 AM

him

        you to check weather all the data's are in one table and this try to get in qry or in VB coding to calculate the total no. of items which you are selecting in the combo box . this should be done in onChange or afterupdate event ....
 try this if you find difficult we ill provide the Code or query idea



anukagni


mboyisis April 1st, 2008 02:12 AM

Hi Anukagni,I have everything in one table and one form.Here is the case:My table is called registration,from is Regform,combo box called genderCombo and up to 4 text boxes being Proftext,Misstext,Mrtext and Mstext.e.g. If i select Professor for the 1st time from the list in combo box,it should display 1 in Protext.If i do it for 2nd and 3rd,it should increment the number to 3 in the same textbox.
Pliz help...







mboyisis April 2nd, 2008 07:20 AM

I tried the code below but it only displays what i have selected from combo box into textbox.(i.e. if i select Prof,it display Prof in the text box instead of number 1, when i select it for the first time).
NB:I tried it using Prof and Miss only.

Private Sub genderCombo_AfterUpdate()
 If Me!genderCombo = "Prof" Then
    Me!Proftext = "Prof"
 Else
    Me!Misstext = "Miss"
End If
End Sub





SerranoG April 4th, 2008 07:08 AM

Do you need to keep this count after the form is closed or do you just want to count how many titles you entered for this session and then NOT keep that number for future use?

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division


All times are GMT -4. The time now is 07:23 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.