Opening Form to specified record

S

Secret Squirrel

I have a form that I use to show reminders for specific records. When I click
my command button on this form to open my main employee form it will go to
the record selected based on this code:

DoCmd.openForm "frmEmployeeMain", , , "tblEmployees.ID = " & [ID]

On my main form I have a listbox that shows all my employees but that list
does not select the employee in which I selected based on the above code. How
do I have the listbox go to that employee and highlight it in the listbox?
The form does go to that record but the listbox stays at the top.
 
S

Secret Squirrel

I can't tell if it's working because it's not hightlighting the name.
When I open the frmEmployeeMain on it's own it highlights the first name in
the listbox and that is the record I see on my form. But when I pass this
from my reminder form nothing is hightlighted but it does select the correct
employee. How do I get it to highlight the name in the listbox?

Steve said:
Apparently your listbox is unbound or it would select the employee in which
you selected based on your code. That's OK if that's what you need for the
listbox. To move the listbox to the selected employee, put the following
code after your "DoCmd...." line of code.

Forms!FrmEmployeemain!NameOfYourListBox = Forms!NameOfYourReminderForm!ID

Steve


Secret Squirrel said:
I have a form that I use to show reminders for specific records. When I
click
my command button on this form to open my main employee form it will go to
the record selected based on this code:

DoCmd.openForm "frmEmployeeMain", , , "tblEmployees.ID = " & [ID]

On my main form I have a listbox that shows all my employees but that list
does not select the employee in which I selected based on the above code.
How
do I have the listbox go to that employee and highlight it in the listbox?
The form does go to that record but the listbox stays at the top.
 

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