Loading a specific record

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have a form that is bound to a recordset. There is an unboumd textbox on
the form and when the user enters an ID in this textbox, the record
associated with that ID should display as the current record, populating all
of the bound controls.

Can anyone give me an idea how to implement this?

I tried coding the AfterUpdate event of the textbox. And then I to clone
the underlying recordset and move to the designated record as

rs.Find "[custid]=" & str(Nz(Me![txtcustid], 0))

but I get a type mismatch error.

Can anyone who has done this before give me an idea how to implement it?

And how do I handle the input of a "bad" (nonexistant) ID? (I need to use
a textbox rather than cbo in order to speed data entry.)

Dave
 
Dave

Actually, data entry would probably be faster if you used a combo box!
Forcing your users to know/remember an ID# is not particularly
user-friendly.

One way to accomplish what I think you've described is to use an unbound
combo box in the header of the form. The source for the combo is, at
minimum, two fields: the first is the ID, with the width set to zero; the
second is a field that holds something that the user would be better able to
use to differentiate between different records. For example, if you were
talking about persons, you could concatenate the persons' names (Last, First
Middle) in your query. By setting the combo box property LimitToList and
AutoComplete, your user might be able to get by just typing the first few
characters!

In the combo box's AfterUpdate event, requery the form with something like:

Me.Requery

NOTE: this means that your form's source needs to be a query that uses the
combo box as a selection criterion. In other words, the form's underlying
query needs a "where" clause that says "look at the combo box and find me
the record(s) with the value in the combo box. By having the ID# as the
first (i.e., the "bound") column, this will force the query to look for the
ID corresponding to what was selected in the combo box.
 
Thanks Jeff

How do I set the cbo property "AutoComplete?"

I see an "AutoExpand" property but no "AutoComplete."

It appears to be on by default but is a setable?
 
Dave

My bad -- AutoExpand it is! Check the properties for the control -- you can
change most any of those.
 
Back
Top