Need help with record navigation after setting recordset

G

Guest

I am accessing a stored procedure form an event procedure to find some records. I am not sure about the proper statements and their sequnce. This is what I have:

cn.Open strConnection
Set cmd.ActiveConnection = cn
cmd.ActiveConnection.CursorLocation = adUseClient
cmd.CommandText = "FindRecords"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("Search", adVarChar, , 3, Search)
cmd.Parameters.Append cmd.CreateParameter("Match", adVarChar, , 3, Match)
cmd.Parameters.Append cmd.CreateParameter("What", adVarChar, , 25, What)

rst.CursorLocation = adUseClient
rst.Open cmd, , adOpenDynamic, adLockOptimistic
rst.MoveLast
Set Forms![Update].Recordset = rst

This works and the Update form is populated with one of the records of the recordset. The problem is that I can use a Previous Record button on the Update form but not the Next Order button once I have reached the first record in the recordset. In other words, navigation is very limited. If I replace MoveLast with MoveFirst I can only see one record. What statements do I use and in what order to be able to navigate back and forth through the resulting recordset?
A second problem is that I cannot change anything in the bounded controls even though the default recordsource is an existing table. What do I need to be able to change some of that data.

Thanks.
 
G

Guest

Additional Notes: The Update form is the same form used for normal navigation through records from a table. That is, the Next Record and Previous Record buttons use the standard MS code for Next Record and Previous Record navigation. I would not like to change that.
Also, when I use an SQL String for the RecordSource of the Update form, I have no problem with navigation or updating data.
However, it seems that the navigation with recordsets is quite a bit more complicated. While the RecordSource is updated when the Recordset is changed, they do not seem to behave or can be accessed the same way. So the question is: Why is there not an easy conversion between RecordSource and Recordset to prevent the problems I am having? If there is a way to accomplisg what I want to do, I like to hear it

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top