Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initialization of Combo Box object from row source

Status
Not open for further replies.

asplus2012

Programmer
Aug 16, 2012
3
CA
Hi,

I copied a form with a combo-box into a new form. I have modified the row source to return only certain information by using the WHERE clause in my SQL Statement.

When my new form is displayed, my combo-box is empty. If I click on it, it shows me the entries that match my selection criteria on the second and subsequent lines. I can then choose one of them or click again on the empty combo-box first line (which is blank). The result will be either my chosen line or the blank line. As soon as I select a non-blank entry, the blank line is not present in any further selections (which is OK).

I have another set of fields that control the date range. This is initialized in the open event of the form. If I change the start date and focus out of the start date field by clicking elsewhere, the record source of the form is refreshed but it is using my blank entry in my combo-box and this returns all data that matches the date range.

On my original form (with no WHERE clause in the row source of the combo-box) the combo-box appears with a valid record from the feeding table already shown.

My question are: When is the combo-box initialized from the row source query that it contains? Why is there a different behavior when I do not use the WHERE clause in the SQL statement?

Thank you in advance to anyone who can help me with this.

Bernard Le Jour
AS Plus Informatique Inc.
 
I am answering my own post.

Just found out that there is a default value in the row source of the combo-box. I was triggering a blank entry by having a default value that did not match any of the selections of the WHERE clause of my SQL statement.

Hope this can help someone else.

Thanks for reading my post.

Bernard Le Jour
AS Plus Informatique Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top