[Show all top banners]

chulbuley
Replies to this thread:

More by chulbuley
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 Help needed from Access guru
[VIEWED 5857 TIMES]
SAVE! for ease of future access.
Posted on 02-22-11 1:32 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I am trying to create a Form in Access Database which has following fields:

Subject_ID
Date
Ethnic_category
Ethnic_Type
Father
Mother
GrandPa
GrandMa
------------------------------
Subject_ID  and Date  are in main form. Rest of the fields are  in sub-form

Father, Mother, GrandPa, and GrandMa are check Box

Ethnic_category and Ethnic_Type are Combo Box with pre-defined values are limited to following:

Ethnic_Category           Ethnic_Type
     Jewish              :         Ashkenazi Jewish
                                        Sephardic Jewish

     European         :          Northern European
                                         Central European
                                         Scandinavian

      Asian                :        Chinese
                                        Japanese
                                        Thai

     Latino/Hispanic     :    Mexican
                                         Cuban 
---------------------------------------------------
The idea of this form is to be able to store all the information into a single table and since one person's ancestry can have multiple ethnicity, we can't make Subject_ID as a primary key and should be able to store multiple rows for same SubjectID. 

For example:   
 Subject_ID    Date          Ethnic_category     Ethnic_type        Father     Mother     GrandPa    GrandMa
    1001          1/1/2011        Asian                         chinese             1              Null               1                 1
    1001          1/1/2011        European                 Northern          Null             1                 Null            Null
    1002          1/2/2011        Latino                        Mexican            1              1                   1                 1
    1005          1/5/2011        Asian                         Thai                   1            Null              Null          Null
    1005          1/5/2011        Asian                         chinese           Null             1                 Null          Null
    1005         1/5/2011         Jewish                      Ashkenazi         Null            Null               1             Null
    1005         1/5/2011         Latino                       cuban               Null           Null              Null             1 
----------------------------------------------------------------------------------------------------------
My problem is :
I was able to input all the values of  Ethnic_Category and Ethnic_type in a combo box and it will give user  an option to select any of the pre-defined values and will store in the table but i want to control the second combo box (Ethnic_type) based upon the selection of first combo box (Ethnic_category) . For example if a person select "Asian" from the category the ethnic_type list should display only "Chinese" , "Japanese" , and "Thai" and similarly if i change it to Latino/Hispanic category it should display only Mexican and cuban and store the record after the selection is made

I am a rookie when it comes to writing VB scirpts and tried some of the codes from google search but still couldn't control my combo box properly.

I followed this link too but it didn't work: 
http://office.microsoft.com/en-us/access-help/basing-one-combo-box-on-another-HA001173058.aspx 

any help will be greatly appreciated.  Thanks

Last edited: 22-Feb-11 01:36 PM

 
Posted on 02-22-11 1:55 PM     [Snapshot: 8]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 I guess u need to start redfining data tables first, u will need another table (tableEthinicity) where you can have Ethinc Category and Ethnic type 

then write a code something like ( i am saying like because I have not tested but should work)

Private Sub combo1_AfterUpdate()
   

    ETvalues = "SELECT [tableEthinicity].[ETID]," & " [tableEthinicity].[ECID]," & " [tableEthinicity].[ETname] " &"FROM tableEthinicity " & "WHERE [ECID] = " & combo1.Value
    Me.combo2.RowSource = ETvalues
    Me.combo2.Requery

End Sub

 
Posted on 02-22-11 3:36 PM     [Snapshot: 60]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

hi Shivanagar, Thanks for your quick reply

I created a table as you said named "tableEthnicity"
defined all the columns (ECID, ETID, ECName, ETName)

inserted all the values :
 ECID     ETID     ECName                 ETName
  1             1         Jewish                Ashkenazi Jewish
 1          2       Jewish            Sephardic Jewish
 2          1       European        Northern 
 2          2       European        Central
 2          3       European        Scandinavian
 3          1       Asian             chinese
 3          2       Asian              japanese
 3          3       Asian              thai 
-----------------------------------------------------
in combo box 1:  row source type = table/query
                              row source =  select distinct ECName from tableEthnicity

in combo box 2: row source type = value list
                              row source =  Ashkenazi Jewish; Sephardic Jewish; Northern; Central; Scandinavian; chinese; japanese; thai

(please correct me if i should call combo box 2  fields from table ethnicity too)

------------------------------
i wrote the scripts as you mentioned in an "EventProcedure" for comboBox1 AfterUpdate.
but as soon as i select a field from comboBox 1 in form view it gives me compile error :  Method or data member not found highlighting .RowSource

again i don't know much about VB codes but when i type comboBox 2 followed by dot (.) it gives me only one option i.e. comboBox2.value ,  if i type ComboBox1 followed by dot then i can see the option for Rowsource.

please let me know what am i doing wrong. Thanks for your help and time.


 
Posted on 02-22-11 4:38 PM     [Snapshot: 98]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 combo box 2: row source type = value list


dont use the value list, use the table/query

 
Posted on 02-23-11 10:02 AM     [Snapshot: 212]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

hi shivanagar,
 
I used the table query as you said and the row source = SELECT tableEthnicity.ETName FROM tableEthnicity;

but  in the form view as soon as i select one of the  Ethnic Categories, it gives me compile error :  Method or Data member not found focusing on RowSource  (from this line of code "me.combo2.RowSource = ETvalues)
 
Posted on 02-23-11 2:42 PM     [Snapshot: 255]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

for any IT solutions ....post to my thread !!!

 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 90 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
Toilet paper or water?
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
From Trump “I will revoke TPS, and deport them back to their country.”
Tourist Visa - Seeking Suggestions and Guidance
advanced parole
Sajha Poll: Who is your favorite Nepali actress?
ढ्याउ गर्दा दसैँको खसी गनाउच
To Sajha admin
Problems of Nepalese students in US
Mamta kafle bhatt is still missing
अरुणिमाले दोस्रो पोई भेट्टाइछिन्
seriously, when applying for tech jobs in TPS, what you guys say when they ask if you have green card?
Are Nepalese cheapstakes?
Nepali Psycho
MAGA denaturalization proposal!!
How to Retrieve a Copy of Domestic Violence Complaint???
wanna be ruled by stupid or an Idiot ?
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters