cbo for record / next record

P

patti

I have a form that has a combo box to choose the record user wants to
display. The cbo is based on a query that has prmary key, last name sorted
ascending, first name sorted asecnding. the drop down list works fine - user
selects patient name and gets correct data.

The issue is i have a command button for next record. clicking it makes form
go to next record #; i want it to go to next alphabetical name. Can someone
guide me through what i need to do.

thanks.

patti
 
A

Arvin Meyer [MVP]

Perhaps it might be better to filter all your records by the combobox,
rather than going to the first matching record. Change the code in the combo
box to read something like:

Sub cboMySearch_AfterUpdate()
Me.Recordsource = "SELECT * FROM MyTable WHERE ([LastName]='" &
Me.cboMySearch.Column(1) & "')"
End Sub
 
P

patti

Thanks for the speedy reply.

I changed the record source to a sorted query and that seems to have made a
difference.

Arvin Meyer said:
Perhaps it might be better to filter all your records by the combobox,
rather than going to the first matching record. Change the code in the combo
box to read something like:

Sub cboMySearch_AfterUpdate()
Me.Recordsource = "SELECT * FROM MyTable WHERE ([LastName]='" &
Me.cboMySearch.Column(1) & "')"
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


patti said:
I have a form that has a combo box to choose the record user wants to
display. The cbo is based on a query that has prmary key, last name sorted
ascending, first name sorted asecnding. the drop down list works fine -
user
selects patient name and gets correct data.

The issue is i have a command button for next record. clicking it makes
form
go to next record #; i want it to go to next alphabetical name. Can
someone
guide me through what i need to do.

thanks.

patti
 

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