Is there an Easy way to move between records????

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a drop down list on my form that has the list of all the
users(records). Rather than just having a forwad and backwards button to move
between records I want to use this drop down list to be able to jump back and
forth in the recordset to display different records. There are probably abut
30-40 different fields that can have different values for each record. In the
past to switch between records I've had to tell each control to update with a
new value by finding the the record that is the same as the name selected in
the drop down and then setting each field in the form to the values in that
record like:
if me.UserName = rs.fields("UserName") then
me.field1.value = rs.fields("field1")
me.field2.value = rs.fields("field2")
and so on
end if

This worked great, but when I did this my form only had like 10-15 fields.
The new database I'm creating has 30-50 fields on the form(mostly
checkboxes). So is there an easier way to update all the fields once a new
record has been selected in the drop down? Something like requeryin the form
based on the username selected if the username is the primary key. Does this
make sense?

Thanks.
 
Your form should be based on a recordset containing a single record. Do this
via the filter property.
Your recordsource will say SELECT * FROM tblTable
Your Filter property will say [ID]=PrimaryKey
As you go forward or backward through the records, simply change the filter
property via an applyfilter.
e.g.
DoCmd.ApplyFilter , "[ID]=" & lngID

Look up Applyfilter in Access HELP

-Dorian
 
Back
Top