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.
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.