View Full Version : need to refresh and have it stay at same record


cliff7376
11-10-2001, 07:38 AM
I have a refresh button with this code in it.
Dim key As String
Dim stDocName As String

key = Me!primary

stDocName = "filter"
DoCmd.RunMacro stDocName

DoCmd.GoToRecord acDataForm, "certifications", acGoTo, key

the purpose of it was to put the record number in a variable. refresh the screen and then go to that record. it works fine until i get up to my 11500 record or so then it tells me "you can't go to that specified record. What am I doing wrong?

cliff7376
11-10-2001, 07:52 AM
i just found my problem but i dont know how to fix it. i want to have the code say gotorecord where primary field = varialble. can anyone help.

Jack Cowley
11-10-2001, 08:13 AM
Give this a try...

Dim key As String
Dim rs As Object
Dim stDocName As String

key = Me!Primary

stDocName = "filter"
DoCmd.RunMacro stDocName

Set rs = Me.Recordset.Clone
rs.FindFirst "[PrimaryKey] = '" & key & "'"
Me.Bookmark = rs.Bookmark

[This message has been edited by Jack Cowley (edited 11-10-2001).]