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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading records in access

Status
Not open for further replies.

puppy39

Programmer
Mar 13, 2009
41
US
I am currently using an access ADP project connecting to SQL. I have a combo boxes called LeadID to filter a form. When I select a lead number higher than 1000 I get the follwoing error: Run-time error '2001' You canceled the previous operation. I click debug and the code stops at "If Not rs.EOF Then Me.Bookmark = rs.Bookmark" but if I click end and then select Lead ID# 1500, then 2000 etc... until little by little all the records are loaded then I don't get the error message anymore.

How can I load all the files at once?

This is the code in the combo box but I think the problem is in loading the records.

Private Sub Combo550_AfterUpdate()
' Find the record that matches the control.
Dim rs As ADODB.Recordset
Set rs = Me.Recordset.Clone
rs.Find "[LeadID] = " & Str(Nz(Me![Combo550], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


 
Not for sure but try
Code:
    Set rs = Me.Recordset.Clone
    rs.MoveLast
    rs.MoveFirst
    rs.Find "[LeadID] = " & Str(Nz(Me![Combo550], 0))

djj
The Lord is My Shepard (Psalm 23) - I need someone to lead me!
 
Thank you for your help djj55 rs.movelast and rs.movefist did not work but you got me thinking on the right path. I added in the load event of the form DoCmd.ShowAllRecords and voila it worked. Thanks! :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top