Combo Box Issue

F

FA

Hi Freinds,
I have ten combo boxes on a form that takes only Yes or No. There is a
reason to make them as combo instead of making check boxes.
The data in these ten fields is comming from a JSP Webpage. There are
10 check boxes on the webpage and user can check one or many. The data,
its providing me from the JSP page is if the user check the box, it
gives me 'qr02a' for one check box, similarly for other check boxes if
the user check the box on the webpage it gives me the data in form of
'qr03a, qr04a and so on. I get the data in an excel sheet and then i
upload it on the sql server.
I couldnt make the check boxes on my MS Access form since it only allow
me to take 1,2,0,,,.
Thats the reason i had to make the combo box for each check box option.
I want to do something like following:
If the combo box does not gets the any value from the excel sheet, i
want it to automatically show the value NO on the form. For each of the
ten options i have the lookup tables having the following values:
Following is an example of one lookup table.
DA_ID DA
qr02a Yes
qr02b No

I tried to pass 'qr02b' on the form open event but its not working.
Private Sub Form_Open(Cancel As Integer)
If Nz(Me.DA_ID) <> "" Then
DA_ID = "qr02b"
End If

Its not working for me folks. Can someone help me out please.


Thanks

Moe
 
W

Wayne Morgan

The form's Open event is too soon to do this, try the Load event. From the
help file: The Open event occurs when a form is opened, but before the first
record is displayed" and "The Load event occurs when a form is opened and
its records are displayed."

Have you tried setting a Default Value for the field in the table so that
when the record is created, if there is no value for that field then the
"no" answer will be created automatically? Are you using a query to import
the Excel data to SQL? If so, you could make these calculated fields in the
query to supply the "no" answer if the "yes" answer isn't there. Also, on
the form, if you wanted to use checkboxes and the data is for display only
(you're not going to edit it) you could make the checkboxes calculated
controls. You could use an IIF() to return True or False to make the
checkbox checked or unchecked.
 
F

FA

Thanks Wayne, but i want to stick with the combo box for now since the
application is about to go in production in couple of days and i dont
want to create any problem. I tried the Form Load event and used the
same code but it didnt work. can you please tell me what code should i
use to pass the value "qr02b" in the combo box if it is empty.
I am not importing it through query, but the Data Transfer Package
tools.
I also tried to set the default value in the combo box as ="qr02b" but
this also didnt work.

Please help me out.

Thanks

Moe
 
F

FA

Also i forgot to answer one of your question. YES these values are just
for display only and will not be edited or changed. So if you happen to
have the IIF code or guide me writing that code then please let me
know. May be in future i will change those combo into check boxes in
version 2. But if possible for now i really need those combo box to be
filled with values, so if there is no value i need "No" to be shown in
the combo box.
 
F

FA

Ok I have this code in the Form Load event and still not able to insert
the value "qr02b" in the record.

If Nz(Me.DA_SOX_ID) <> "" Then
Me.DA_SOX.Value = DA_SOX.ItemData(0)
End If

Where DA_SOX_ID is the ID for the lookup table and DA_SOX is the name
of the combo box.

Please help me out.

Thanks
Moe
 
W

Wayne Morgan

You say the combo box is "empty". Have you added the expected values to the
Row Source in any way (a list of items or a query)? The value in a combo box
will normally need to come from this list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top