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!

Using a combo box value to select a record 1

Status
Not open for further replies.

purpledawn

Programmer
Jun 21, 2001
50
US
I'm making a form to allow the user to edit a single column table. Rather than using the Find tool, I want to let the user select the record using a list of values using the combo box.

I am using the following code:

Docmd.FindRecord Me.cbo_edit

on the AfterUpdate event of the combo box. This doesn't produce any errors, but neither does it change the record. The Control Source is set, and the record source is a query of the table that merely puts it in ascending order.

Any ideas on how to change the record on a form using a combo box and keeping focus on the combo box?

 
Hi!

For searching of form's record combobox must be defined as unbound.

Codes for searching of record:

private sub cbo_edit_AfterUpdate()
dim rst as recordset

set rst=me.recordsetclone
rst.findfirst "MyField=" & cbo_edit
if not rst.nomatch then
me.bookmark=rst.bookmark'Use ' for text field or # for date field
end if
rst.close
set rst=nothing
end sub

Aivars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top