You can type a value in a combo box.
Sounds like you have a pretty good grasp of code and you're writing a more
advanced form tha tI mentioned. Your initial post did not revela your level
of expert knowledge. I had assumed you were fairly new and were working
directly in the tables as many new users do. Obviously you're past that.
Personally, I would have my form default to a new record. I'd code my
"find" field to locate a record. If not found, I believe it would issue an
error and leave the user in the add mode.
As far as going to the record, your code would look something like...
Private Sub Combo5_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[EmployeeID] = " & Str(Me![Combo5])
Me.Bookmark = rs.Bookmark
End Sub
This was created using the wizard and a combo-box, but it would work with an
unbound text box as well.
--
Rick B
Leslie said:
Hi Rick,
I have a table "VENDORS" and I don't think a Combo Box will work as we will
probably have too many "Vendors" to choose from. I would rather have the
user type in a value on the VendorID, check to see if that Value exists. If
it exists ask them if they want to edit this record or if they want to enter
a new record or try again. I've got the syntax for reading the VendorID to
see if exists (on Before Update, partial of the message box, but I don't
have the syntax to actually display the record (all fields, e.g. contact
name, phone, etc.) for editting.
I do have the form set up for "Data Entry" so that it doesn't normally
display existing records, but in this case I want to display a record if the
user so chooses.
I hope that gives enough info the help further.
Cheers,
Leslie