Unbound combo box breaking

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

I have a continuous form that lists assignemnts in our department. at the
top of the form I have combo boxes that allow the user to limit the entries
byt supervisorID and employeeID. The underlying query has criteria that
says Like [forms]![FrmOnlineWIP].[FindSupervisor] & "*" and
Like [forms]![FrmOnlineWIP].[FindUser] & "*"

There is also a button labeled "Requery" When clicked, the code behind it
is Me.Requery

This normally works great, but if you put in an invalid combination (an
supervisor along witn an employee who does not work for him/her) then the
form displays no results. The problem is that the two combo boxes
previously mentioned blank themselves out on the screen. I can click on
them, select an id from the resulting drop-down list, but as soon as I click
outside of that box, the field returns to a blank value. The form starts
acting very erratic at this point, and it will not display more records
until it is closed and reopened.

Any ideas on what I did wrong? Is 'requery' the correct command?

Thanks for your help. Let me know if you need more details.

Rick
 
-----Original Message-----
I have a continuous form that lists assignemnts in our department. at the
top of the form I have combo boxes that allow the user to limit the entries
byt supervisorID and employeeID. The underlying query has criteria that
says Like [forms]![FrmOnlineWIP].[FindSupervisor] & "*" and
Like [forms]![FrmOnlineWIP].[FindUser] & "*"

There is also a button labeled "Requery" When clicked, the code behind it
is Me.Requery

This normally works great, but if you put in an invalid combination (an
supervisor along witn an employee who does not work for him/her) then the
form displays no results. The problem is that the two combo boxes
previously mentioned blank themselves out on the screen. I can click on
them, select an id from the resulting drop-down list, but as soon as I click
outside of that box, the field returns to a blank value. The form starts
acting very erratic at this point, and it will not display more records
until it is closed and reopened.

Any ideas on what I did wrong? Is 'requery' the correct command?

Thanks for your help. Let me know if you need more details.

Rick
Hi Rick, I may be wrong... but I get the impression that
the supervisor combobox has the criteria
Like [forms]![FrmOnlineWIP].[FindUser] & "*"
and the employee combobox has the criteria
Like [forms]![FrmOnlineWIP].[FindSupervisor] & "*"

If this impression is correct then you will need to change
this so that the supervisor combobox lists an unfiltered
list of supervisors. The afterupdate event of this
combobox will requery the employee combobox.

The employee combobox has a list of employees filtered to
those that have the selected supervisor using
Like [forms]![FrmOnlineWIP].[FindSupervisor] & "*"

The other thing to be aware of is that when using
continuous forms a combobox list will apply to all
records. So that changing a selection in the combobox will
affect all records in every 'form' of the continuous form.

Luck
Jonathan
 
---------- "Rick said:
I have a continuous form that lists assignemnts in our department. at the
top of the form I have combo boxes that allow the user to limit the entries
byt supervisorID and employeeID. The underlying query has criteria that
says Like [forms]![FrmOnlineWIP].[FindSupervisor] & "*" and
Like [forms]![FrmOnlineWIP].[FindUser] & "*"

There is also a button labeled "Requery" When clicked, the code behind it
is Me.Requery

This normally works great, but if you put in an invalid combination (an
supervisor along witn an employee who does not work for him/her) then the
form displays no results. The problem is that the two combo boxes
previously mentioned blank themselves out on the screen. I can click on
them, select an id from the resulting drop-down list, but as soon as I click
outside of that box, the field returns to a blank value. The form starts
acting very erratic at this point, and it will not display more records
until it is closed and reopened.

Any ideas on what I did wrong? Is 'requery' the correct command?

Rick,

are those two combos bound? Basically, combos used to enter search
criteria should be unbound (ControlSource property empty). Also, you
could set the first combo as a criteria in the query underying the
second combo, or better, before executing the Requery you could check
if there are records for the entered supervisorID and employeeID
combination. However, this could slow down the process depending on
the data amount, network etc.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
Emilia:

Thanks! The fields are unbound, and I did base the employee combo-box on
the supervisor as you suggested. This helps, but we still have the rare
case where the form loads with the supervisor defaulted and sometimes finds
no active records for that supervisor.

I think your suggestion of checking to see if records exists it what I need.
How would I check to see if records exist, and if not, stop the form from
'crapping out'? Would I pop up a msgbox, and then blank out the supervisor
and let the query continue to pull all records? The supervisor could then
fill in other criteria and continue to use the form.

For example, my manager has no assignments in his name, so when the form
loads he gets errors. He would like to load the form, then enter the userid
for supervisors who report to him, but as soon as the form loads and finds
no records it starts acting up.

Thanks for your help!!

Rick
Emilia Maxim said:
---------- "Rick said:
I have a continuous form that lists assignemnts in our department. at the
top of the form I have combo boxes that allow the user to limit the entries
byt supervisorID and employeeID. The underlying query has criteria that
says Like [forms]![FrmOnlineWIP].[FindSupervisor] & "*" and
Like [forms]![FrmOnlineWIP].[FindUser] & "*"

There is also a button labeled "Requery" When clicked, the code behind it
is Me.Requery

This normally works great, but if you put in an invalid combination (an
supervisor along witn an employee who does not work for him/her) then the
form displays no results. The problem is that the two combo boxes
previously mentioned blank themselves out on the screen. I can click on
them, select an id from the resulting drop-down list, but as soon as I click
outside of that box, the field returns to a blank value. The form starts
acting very erratic at this point, and it will not display more records
until it is closed and reopened.

Any ideas on what I did wrong? Is 'requery' the correct command?

Rick,

are those two combos bound? Basically, combos used to enter search
criteria should be unbound (ControlSource property empty). Also, you
could set the first combo as a criteria in the query underying the
second combo, or better, before executing the Requery you could check
if there are records for the entered supervisorID and employeeID
combination. However, this could slow down the process depending on
the data amount, network etc.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
Back
Top