trouble populating combobox

lulubell-b
lulubell-b used Ask the Experts™
on
Hello,

I'm trying to populate a combo box on a form load() and I've been having issue.

Initialy I have a form that is being populated on a record source from table tblExport. I'm trying to validate some columns on the form with the form load().

Is this possible? I have no idea what I'm doing wrong.

Thank you

Public Sub Form_Load()
      
Dim Day11 As String

Day11 = "W"
    
    If IsNull(Forms!frmCalendar!cbo11) = True Or Forms!frmCalendar!cbo11 = "" Then
                Me.cbo11 = Me.cbo11.Column(1)
       
        'End If
    Else
           
    End If
    
End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:


Note quite sure what you are trying to do ... ?

Public Sub Form_Load()
     
      Dim Day11 As String

     Day11 = "W"
   
    If Nz(Forms!frmCalendar!cbo11 , "") = "" Then  Me.cbo11 = Me.cbo11.Column(1) ' ????????
       
 
End Sub

Author

Commented:
I'm grabbing the data from a table directly to populate the form, but I need to virtually populate the blank (or null) cells with a value.

GOAL: Populate the null cells without inserting into the table.

Is this possible or do I have to insert the values into the table in order to show the values on the form?

 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
"Is this possible or do I have to insert the values into the table in order to show the values on the form?'

Well ... if ... your control(s) is *not* bound to a field in the table, then no ... you don't have to insert into the table.  But, if your control(s) is bound to a field in the table, then it will be 'inserted' into the table once the record is *saved*.

mx
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
How do I populate the field on the form when the value is null?

Author

Commented:
These are the properties for combobox cbo11

control Source 11
Row Source Type Table/Query
Bound Column 1
Show Only Row Source No
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
What is frmCalendar ?
Is that this form ?

Sorry ... I'm just not following what you are wanting to do ?

mx

Author

Commented:
Yes that is the form.

I have form called frmCalendar that is being populated using table Export. The form has fields called

TeNm   |  BaseNm  | 11
-----------------------------------
12345     ABC             W
55555     BDD             C
77778     XXX


11 is the combobox. When the form is loaded it grabs the values from the table and placed it into the objects on the form.

I need to populate a value where 11 is blank just on the screen. I thought I could perform that using the FORM_LOAD() event.

Does that clarify any>

Author

Commented:
?????? Does that make sense?????
Hello

You display a table tough a form. The field [11] can be empty, and you want to display something in that case.

1) If the form or the field is read-only, replace the control source with: =Nz([11],'X')
Now the combo can display the 'X' and perhaps a translation of the code 'X' used for missing information.

2) If the user needs to edit this field, and you still need to display something when it's blank, you can use this format: @;;"(missing)"
Now the message will be displayed instead of a blank combo box. Note that this only works if the bound column is visible.

I guess I'm unclear on what `populate´ means. I know it's used a lot in DB context, but I never know exactly what it meant by it. Perhaps you are really looking for a way to update your entire table and replace the missing values by a default value? Or you want to prevent editing of the form unless the user provides a value for that field?

Cheers!
(°v°)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial