View Single Post
  #11  
Old November 17th, 2009, 12:47 AM posted to microsoft.public.access.forms
Scott_Brasted via AccessMonster.com
external usenet poster
 
Posts: 49
Default Using a Combo Box to Find Records

Jeanette,

Here is what is in imm. win:
First item on combo list is: Setup ID
But if I perservere and get past the error message, the correct data is in
the cbo.

SetupID is the autonumber primary key for the table for the main form. The
table is the list of fund raising campaigns and the field in the combo box is
the campaign name. I get the error: The value you entered isn't valid for
this field. Does it matter that there is a subform?

Thanks,
Scott

Jeanette Cunningham wrote:
Scott,
I am just getting back to this thread - it is 6am here in Australia.

This code--
Private Sub cboMoveTo_OnLoad()
Me.[cboMoveTo] = Me.[cboMoveTo].ItemData(0)
End Sub

is meant to make the combo show the first item that you would see if you
clicked on the combo. By the way, the line --
needs to be put in the Form_Load event.

The idea is that when the form load event runs, it puts that first item in
the combo.
The load event always runs when a form is opened.

Let's check out why this doesn't work for you.

In the code you have on the Form_Load event,
put this line
Debug.Print "First item on combo list is: " & Me.cboMoveTo.ItemData(0)

Now open the form.
Press Alt + G to open the Immediate window.
Look what access has put for the first item in the combo.

Let us know what access put in the immediate window.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Bruce,

[quoted text clipped - 107 lines]
Thanks,
Scott


--
Message posted via http://www.accessmonster.com