Radio button and Combo Box Problem

everblue

Registered User.
Local time
Today, 12:01
Joined
Jul 20, 2002
Messages
21
Hi all,
I have two combo boxes and an option group having two radio buttons. I want the user to select from only one of the combo boxes. to ensure that i need to disable one of the combo boxes.
The user should select which combo to be enabled by clicking any of the Radio buttons. Also when a combo box is disabled, the value should be set to null or empty, coz I need 0 to be placed in the related field of the db.
suppose my combo box's names are

combo1, combo2
option1, option2
frame1

can anyone write me the complete code and the events that are needed. I know it is every easy, but still.

I hope I was clear in explanation.
Thanx
 
Please talk a little more about the contents of the combo boxes. In many situations, it's possible to use just one combo box and modify the source code based on the option selected by the user.

For example, here's some code where the user specifies whether to search by Name or SSN. In the afterupdate event of the option group, the combo box's row source is modified accordingly.
Code:
Private Sub grpSearchFor_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT SSN, LastName, FirstName FROM tblClients "

Select Case grpSearchFor
Case 1  'search by name
strSQL = strSQL & "ORDER BY LastName, FirstName; "
Me![cboFindSomeone].ColumnWidths = "0 in;0.75 in; 0.75 in"

Case 2  'search by SSN
strSQL = strSQL & "ORDER BY SSN; "
Me![cboFindSomeone].ColumnWidths = "0.75 in;0.75 in; 0 in"

End Select

Me![cboFindSomeone].RowSource = strSQL
Me![cboFindSomeone].Requery
Me![cboFindSomeone].SetFocus
Me![cboFindSomeone].Dropdown
Me!grpSearchFor = Null
End Sub
 
Hi raskew,

thanx for ur time and effort. Let me tell u a bit bout the contents of two combo boxes.

I have designed a database to record any problems facing our customers. Our customers are of two types.

1. Organizations (with fields - Org_ID, Org_name, Address, Contact Person, Telephone, Email, Faxt, Acronym)

2. Individuals(ID, Name, Address, Tel, Email)

Now, I have created two seperate tables (one for Organizations, one for Individuals, Org_id, ID is the primary key respectively).

in the main table which is called "Problem", I used those to PK as forign key. the fields in this table are (Problem_ID, Problem_DESc, Org_id, ID, Date, Time....)

Now, if the cusotmer is an organization, the ID field should be 0. if the customer is individual person, Org_iD should be 0. to implement this, I have used to combo boxes that fetch the name and ID of each table. I used an option group control to disabled one of the combo boxes and set the value to 0.
I was able to control the enabling and disabling of the combo box and couldn't set the value (text) to 0.

I also tried to combine organization and individuals in one combo box, but the ID will be duplicate... i hope i was good in explaining.

Back to you....
 
This is a little off topic, but anyway.

I would not keep 2 Customer tables. A customer is a customer. I would create one Customer table with 2 linked tables for addess information. The 2 linked tables can have different fields for corporate and individual customers.

I have done this kind of thing before and it is better in the long run to have only one primary table for customers.

HTH,
RichM
 
Since your location is Afghanistan, I'm suspecting that we're looking at a military scenario. Perhaps you'd fill us in.

If this is the case and Organizations are things like HHC, 1/11th Mess Kit Sanitation Bn, and Customers are PFC Willie P. Jones, 123-45-6789, then I'd be very cautious about combining the two tables. Although both fall in the category of "Customers", then are some very distinct differences that would make me reluctant to create one table.

Consider this, if your scenario was a medical clinic, would you combine patients and staff in one table? Or, a police organization, would you combine police personnel and America's Most Wanted in the same table? In each case, they are all "People".

A little more info would be helpful.
 

Users who are viewing this thread

Back
Top Bottom