Hlp! Requery Cbo Not Working

J

Joyce

Hello,

I'm using Access 2000. I added a combo box to enable users to select an
existing employee name. The source of the form is a query that contains the
last&", "&first to concatenate the two fields so they show correctly in the
combo box.

Everything is fine until I add or delete an employee. The combo box doesn't
update automatically, so I added the following event in the form's After
Update:

Private Sub Form_AfterUpdate()
Me!cboName.Requery
End Sub

However, now the combo and the employee records no longer are in synch.
Nothing at all happens when I select an employee name.

I have tried a variety of requery events - form, combo box, both.... but
they all result in this problem.

Any suggestions?

Thanks!
 
J

Jeff Boyce

Joyce

When a user selects an employee name, how is that causing the form to
display the selected employee? Is there a procedure in the AfterUpdate
event?

How many records are "in" the form? Just one (the selected employee), or
???

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
J

Joyce

Hi Jeff,

The form displays one employee record at a time Single Form default view.

I added an unbound Combo Box that allows the users to select an employee
name. The form is based on a query that contains first name, last name, a
few other employee-related fields, plus an expression: Name: [LastName] & ",
" & [FirstName] which I use to display employee last name and first name in
the combo box.

When I am simply viewing the employees, everything works fine. However,
when I add a new record, or delete an existing record, the After Update Event
Procedure as noted in my post,

Private Sub Form_AfterUpdate()
Me!cboName.Requery
End Sub

it not only doesn't refresh the content of the combo box, but when I select
an existing employee's name, it doesn't go to that employee. It just keeps
the currently added employee name (or first employee in the table) displayed.

I hope I've more clearly explained the problem.

Thanks so much.
 
J

Jeff Boyce

Joyce

If I'm understanding, you aren't using the AfterUpdate of the combobox, but
of the entire form.

I too use an unbound combobox to "select an employee", but use the
combobox's AfterUpdate event to requery the form. For the form itself, I
feed it with a query that looks to the combobox for an ID. ?Nobody
selected? Then the form display that (nothing) record. ?Selected employee?
Then the form displays THAT employee.

Good luck

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

Joyce said:
Hi Jeff,

The form displays one employee record at a time Single Form default view.

I added an unbound Combo Box that allows the users to select an employee
name. The form is based on a query that contains first name, last name, a
few other employee-related fields, plus an expression: Name: [LastName] &
",
" & [FirstName] which I use to display employee last name and first name
in
the combo box.

When I am simply viewing the employees, everything works fine. However,
when I add a new record, or delete an existing record, the After Update
Event
Procedure as noted in my post,

Private Sub Form_AfterUpdate()
Me!cboName.Requery
End Sub

it not only doesn't refresh the content of the combo box, but when I
select
an existing employee's name, it doesn't go to that employee. It just
keeps
the currently added employee name (or first employee in the table)
displayed.

I hope I've more clearly explained the problem.

Thanks so much.


Jeff Boyce said:
Joyce

When a user selects an employee name, how is that causing the form to
display the selected employee? Is there a procedure in the AfterUpdate
event?

How many records are "in" the form? Just one (the selected employee), or
???

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.




.
 

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