469,323 Members | 1,560 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

Requery, Return to record

MS
Access 97

I want to requery the data being displayed on a form, then I want to return
to the record I was in.

Why doesn't this code work?

Private Sub CmdRefsh_Click()
Dim RecId As Integer

RecId = Me.TxtID
Me.Requery

With Me.RecordsetClone
.FindFirst "[ID] = " & RecId
End With

End Sub


Any help?

Thnaks!
Nov 13 '05 #1
20 9901
Try this:

Dim RecId As Integer
RecId = Me.TxtID
Me.Requery

With me.RecordsetClone
.FindFirst "ID" & "=" & RecId
me.Bookmark = .Bookmark
me.RecordsetClone.Close
End With

MS wrote:
Access 97

I want to requery the data being displayed on a form, then I want to return to the record I was in.

Why doesn't this code work?

Private Sub CmdRefsh_Click()
Dim RecId As Integer

RecId = Me.TxtID
Me.Requery

With Me.RecordsetClone
.FindFirst "[ID] = " & RecId
End With

End Sub


Any help?

Thnaks!


Nov 13 '05 #2
MS

"lauren quantrell" <la*************@hotmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
Try this:

Dim RecId As Integer
RecId = Me.TxtID
Me.Requery

With me.RecordsetClone
.FindFirst "ID" & "=" & RecId
me.Bookmark = .Bookmark
me.RecordsetClone.Close
End With

Perfect!

Thanks :-)
Nov 13 '05 #3
You don't want to close recordsetclone. Since you don't open recordsetclone,
you don't need to close it.

Neil

"lauren quantrell" <la*************@hotmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
Try this:

Dim RecId As Integer
RecId = Me.TxtID
Me.Requery

With me.RecordsetClone
.FindFirst "ID" & "=" & RecId
me.Bookmark = .Bookmark
me.RecordsetClone.Close
End With

MS wrote:
Access 97

I want to requery the data being displayed on a form, then I want to

return
to the record I was in.

Why doesn't this code work?

Private Sub CmdRefsh_Click()
Dim RecId As Integer

RecId = Me.TxtID
Me.Requery

With Me.RecordsetClone
.FindFirst "[ID] = " & RecId
End With

End Sub


Any help?

Thnaks!

Nov 13 '05 #4
Suggest you dim RecID as Long. Integer only goes to 32,000. If you have more
records than that, the code won't work. Long goes to 2 trillion.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"MS" <Em***@Myemail.com> wrote in message
news:Fk*******************@news-server.bigpond.net.au...

"lauren quantrell" <la*************@hotmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
Try this:

Dim RecId As Integer
RecId = Me.TxtID
Me.Requery

With me.RecordsetClone
.FindFirst "ID" & "=" & RecId
me.Bookmark = .Bookmark
me.RecordsetClone.Close
End With

Perfect!

Thanks :-)

Nov 13 '05 #5
MS

"PC Datasheet" <no****@nospam.spam> wrote in message
news:YA*****************@newsread3.news.atl.earthl ink.net...
Suggest you dim RecID as Long. Integer only goes to 32,000. If you have
more
records than that, the code won't work. Long goes to 2 trillion.

Thanks for that.

Now, my code is.....

Private Sub CmdRefsh_Click()
On Error GoTo Err_CmdRef

Dim RecId As Long

RecId = Me.TxtID

Me.Requery

With Me.RecordsetClone
.FindFirst "ID" & "=" & RecId
Me.Bookmark = .Bookmark
End With

Exit_CmdRef:
Exit Sub

Err_CmdRef:
MsgBox Err.Description & ". Moving to first record"

Resume Exit_CmdRef
End Sub
It works fine, except if I'm in the first record. If I run it while in the
first record on the form, it "returns" to that record, but then I get an
error (end of recordset) if I try to navigate to the next record.

Any ideas

Nov 13 '05 #6
In what way are you "navigating" to the next record? This code ends when it
returns you to the original record. You must be navigating through some
other means. If it's with the navigation buttons at the bottom of the form,
then you should go to the "new" record. If you're using a custom navigation
button, then the problem is probably there, and you should post the code
used there. But this code ends when it takes you back to the original
record, and, from what I understand, that part's working fine.

By the way, you can change:

.FindFirst "ID" & "=" & RecId

to simply:

.FindFirst "ID=" & RecId

Neil
"MS" <Em***@Myemail.com> wrote in message
news:28*******************@news-server.bigpond.net.au...

"PC Datasheet" <no****@nospam.spam> wrote in message
news:YA*****************@newsread3.news.atl.earthl ink.net...
Suggest you dim RecID as Long. Integer only goes to 32,000. If you have
more
records than that, the code won't work. Long goes to 2 trillion.

Thanks for that.

Now, my code is.....

Private Sub CmdRefsh_Click()
On Error GoTo Err_CmdRef

Dim RecId As Long

RecId = Me.TxtID

Me.Requery

With Me.RecordsetClone
.FindFirst "ID" & "=" & RecId
Me.Bookmark = .Bookmark
End With

Exit_CmdRef:
Exit Sub

Err_CmdRef:
MsgBox Err.Description & ". Moving to first record"

Resume Exit_CmdRef
End Sub
It works fine, except if I'm in the first record. If I run it while in the
first record on the form, it "returns" to that record, but then I get an
error (end of recordset) if I try to navigate to the next record.

Any ideas

Nov 13 '05 #7
I sent you the code "ID" & "=" & recID only because I do this sort of
thing from a public function where I re-use the code for many different
forms where I need the functionality to return to the selected record
before a requery:

For example, on the form I may have an On_Click procedure that opens
something, something like this:

Private Sub CmdRefsh_Click()
Dim myID as long
myID = me.RecID

'run some code here that plays with the record, then requeries the
records...

Call ReturnAfterRequery(me.formname,"RecID",myID)

End Sub

' put the function below in a module which can then be called from any
form:

Function ReturnAfterRequery(myFormName as String, myFieldName as
String, myID as Long)

'myID is the currently selected record
'myFieldName is the name of the ID field of the recordset that will be
requeried
'myFormName is the name of the form that is being requeried

Me.Requery
With Forms(myFormName).RecordsetClone
Forms(myFormName).FindFirst myFieldName & "=" & myID
Forms(myFormName).Bookmark = .Bookmark
End With
End function


Neil wrote:
In what way are you "navigating" to the next record? This code ends when it returns you to the original record. You must be navigating through some other means. If it's with the navigation buttons at the bottom of the form, then you should go to the "new" record. If you're using a custom navigation button, then the problem is probably there, and you should post the code used there. But this code ends when it takes you back to the original record, and, from what I understand, that part's working fine.

By the way, you can change:

.FindFirst "ID" & "=" & RecId

to simply:

.FindFirst "ID=" & RecId

Neil
"MS" <Em***@Myemail.com> wrote in message
news:28*******************@news-server.bigpond.net.au...

"PC Datasheet" <no****@nospam.spam> wrote in message
news:YA*****************@newsread3.news.atl.earthl ink.net...
Suggest you dim RecID as Long. Integer only goes to 32,000. If you have more
records than that, the code won't work. Long goes to 2 trillion.

Thanks for that.

Now, my code is.....

Private Sub CmdRefsh_Click()
On Error GoTo Err_CmdRef

Dim RecId As Long

RecId = Me.TxtID

Me.Requery

With Me.RecordsetClone
.FindFirst "ID" & "=" & RecId
Me.Bookmark = .Bookmark
End With

Exit_CmdRef:
Exit Sub

Err_CmdRef:
MsgBox Err.Description & ". Moving to first record"

Resume Exit_CmdRef
End Sub
It works fine, except if I'm in the first record. If I run it while in the first record on the form, it "returns" to that record, but then I get an error (end of recordset) if I try to navigate to the next record.

Any ideas


Nov 13 '05 #8
Oops,
I saw it as it was saving...
Tahe out the "Me.requery."
It should read:

Function ReturnAfterRequery(myFormName as String, myFieldName as
String, myID as Long)

'myID is the currently selected record
'myFieldName is the name of the ID field of the recordset that will be
requeried
'myFormName is the name of the form that is being requeried

With Forms(myFormName).RecordsetClone
Forms(myFormName).FindFirst myFieldName & "=" & myID
Forms(myFormName).Bookmark = .Bookmark
End With
End function

lauren quantrell wrote:
I sent you the code "ID" & "=" & recID only because I do this sort of
thing from a public function where I re-use the code for many different forms where I need the functionality to return to the selected record
before a requery:

For example, on the form I may have an On_Click procedure that opens
something, something like this:

Private Sub CmdRefsh_Click()
Dim myID as long
myID = me.RecID

'run some code here that plays with the record, then requeries the
records...

Call ReturnAfterRequery(me.formname,"RecID",myID)

End Sub

' put the function below in a module which can then be called from any form:

Function ReturnAfterRequery(myFormName as String, myFieldName as
String, myID as Long)

'myID is the currently selected record
'myFieldName is the name of the ID field of the recordset that will be requeried
'myFormName is the name of the form that is being requeried

Me.Requery
With Forms(myFormName).RecordsetClone
Forms(myFormName).FindFirst myFieldName & "=" & myID
Forms(myFormName).Bookmark = .Bookmark
End With
End function


Neil wrote:
In what way are you "navigating" to the next record? This code ends when it
returns you to the original record. You must be navigating through

some
other means. If it's with the navigation buttons at the bottom of the form,
then you should go to the "new" record. If you're using a custom navigation
button, then the problem is probably there, and you should post the

code
used there. But this code ends when it takes you back to the

original
record, and, from what I understand, that part's working fine.

By the way, you can change:

.FindFirst "ID" & "=" & RecId

to simply:

.FindFirst "ID=" & RecId

Neil
"MS" <Em***@Myemail.com> wrote in message
news:28*******************@news-server.bigpond.net.au...

"PC Datasheet" <no****@nospam.spam> wrote in message
news:YA*****************@newsread3.news.atl.earthl ink.net...
> Suggest you dim RecID as Long. Integer only goes to 32,000. If
you have> more
> records than that, the code won't work. Long goes to 2 trillion.
>
Thanks for that.

Now, my code is.....

Private Sub CmdRefsh_Click()
On Error GoTo Err_CmdRef

Dim RecId As Long

RecId = Me.TxtID

Me.Requery

With Me.RecordsetClone
.FindFirst "ID" & "=" & RecId
Me.Bookmark = .Bookmark
End With

Exit_CmdRef:
Exit Sub

Err_CmdRef:
MsgBox Err.Description & ". Moving to first record"

Resume Exit_CmdRef
End Sub
It works fine, except if I'm in the first record. If I run it
while
in the first record on the form, it "returns" to that record, but then I get an error (end of recordset) if I try to navigate to the next record.

Any ideas


Nov 13 '05 #9
Neil wrote:
You don't want to close recordsetclone. Since you don't open recordsetclone,
you don't need to close it.


Exactly.

Also, if you have any other code that uses recordsetclone without a
requery, keep in mind that the bookmark for recordsetclone stays where
you last left off in .findfirst. If on the next time you use
recordsetclone to search for something, if the next record is BEFORE the
last, the findfirst starts where it last left off and goes to eof and
you won't find it.

For any use of a recordsetclone, it might be good practice to add in a
..movefirst at ythe end of your procedure, just in case.

In MS's case, since s/he is requerying before using recordsetclone, the
recordsetclone is reconstructed and starts at the beginning anyway.
But, IMO, it's still good practice to "reset" and .movefirst. I find
rsclones to be very useful sometimes.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #10
MS

"Neil" <nj****@pxdy.com> wrote in message
news:aQ*************@newsread1.news.pas.earthlink. net...
In what way are you "navigating" to the next record? This code ends when
it returns you to the original record. You must be navigating through some
other means. If it's with the navigation buttons at the bottom of the
form, then you should go to the "new" record. If you're using a custom
navigation button, then the problem is probably there, and you should post
the code used there. But this code ends when it takes you back to the
original record, and, from what I understand, that part's working fine.

Thanks.

I have several custom nav buttons.

I think the "problem" may be with the way my "requery" code "bookmarks".

Two of the most pertinent buttons are thus.......
Private Sub CmdNxtRec_Click()
On Error GoTo Err_CmdNxtRec_Click
DoCmd.GoToRecord , , acNext
Dim IntNewrec As Integer

IntNewrec = Me.NewRecord
If IntNewrec = True Then
MsgBox "End of Data File. " _
& "Returning to last record. " _
& "To create new record, click ""New Record"" "
DoCmd.GoToRecord , , acFirst

Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("QryPatientInfo", dbOpenDynaset)
rst.Requery
rst.MoveLast
rst.Delete
rst.Requery
rst.Close
Me.Requery
DoCmd.GoToRecord , , acLast
End If

Exit_CmdNxtRec_Click:
Exit Sub

Err_CmdNxtRec_Click:
MsgBox Err.Description
Resume Exit_CmdNxtRec_Click

End Sub

And...............

Private Sub CmdPrvRec_Click()
On Error GoTo Err_CmdPrvRec_Click

DoCmd.GoToRecord , , acPrevious

Exit_CmdPrvRec_Click:
Exit Sub

Err_CmdPrvRec_Click:
MsgBox Err.Description
Resume Exit_CmdPrvRec_Click
End Sub

They seem pretty "harmless" to me.

It's wierd how, if I run my "requery" code from the first record, my "move
next" code will not work - yet if I run it from a record in the middle, it's
fine.

BTW, I experimented with this to requery, and return to the record I
"requeried" from ..........

Private Sub Private Sub CmdRefsh()
'on error here
Dim RecID As String

RecID = Me.TxtID
Me.Requery
Me.TxtID.SetFocus
DoCmd.FindRecord RecID, acAnywhere, True, acSearchAll, True, acCurrent, True

'error handling here
End Sub
This seems to do exactly what I want regardless of where I am in the
records. Any dramas using this?

From one hack programmer, thanks everyone for your help! :-)
Nov 13 '05 #11
"MS" <Em***@Myemail.com> wrote in
news:3w********************@news-server.bigpond.net.au:

"Neil" <nj****@pxdy.com> wrote in message
news:aQ*************@newsread1.news.pas.earthlink. net...
In what way are you "navigating" to the next record? This
code ends when it returns you to the original record. You
must be navigating through some other means. If it's with the
navigation buttons at the bottom of the form, then you should
go to the "new" record. If you're using a custom navigation
button, then the problem is probably there, and you should
post the code used there. But this code ends when it takes
you back to the original record, and, from what I understand,
that part's working fine.

Thanks.

I have several custom nav buttons.

I think the "problem" may be with the way my "requery" code
"bookmarks".

Two of the most pertinent buttons are thus.......
Private Sub CmdNxtRec_Click()
On Error GoTo Err_CmdNxtRec_Click


what a lot of convoluted code to do the same thing as

If Me.Recordset.AbsolutePosition + 1 _
< Me.Recordset.RecordCount Then
DoCmd.GoToRecord , , acNext
End If
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #12
I've always just assumed that requeries go to the beginning, so I've never
done a .MoveFirst after a requery, and I've never had any problems. But
there's always a first time I suppose.... ;-)

N

"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:d0**********@coranto.ucs.mun.ca...
Neil wrote:
You don't want to close recordsetclone. Since you don't open
recordsetclone, you don't need to close it.


Exactly.

Also, if you have any other code that uses recordsetclone without a
requery, keep in mind that the bookmark for recordsetclone stays where you
last left off in .findfirst. If on the next time you use recordsetclone
to search for something, if the next record is BEFORE the last, the
findfirst starts where it last left off and goes to eof and you won't find
it.

For any use of a recordsetclone, it might be good practice to add in a
.movefirst at ythe end of your procedure, just in case.

In MS's case, since s/he is requerying before using recordsetclone, the
recordsetclone is reconstructed and starts at the beginning anyway. But,
IMO, it's still good practice to "reset" and .movefirst. I find rsclones
to be very useful sometimes.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me

Nov 13 '05 #13
> Private Sub CmdNxtRec_Click()
On Error GoTo Err_CmdNxtRec_Click
DoCmd.GoToRecord , , acNext
Dim IntNewrec As Integer

IntNewrec = Me.NewRecord
If IntNewrec = True Then
MsgBox "End of Data File. " _
& "Returning to last record. " _
& "To create new record, click ""New Record"" "
DoCmd.GoToRecord , , acFirst

Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("QryPatientInfo", dbOpenDynaset)
rst.Requery
rst.MoveLast
rst.Delete
rst.Requery
rst.Close
Me.Requery
DoCmd.GoToRecord , , acLast
End If
Some notes on the above:

1) You don't need the rst recordset. You can do everything in the
recordsetclone.

2) You don't need to requery after performing an OpenRecordset. By opening
the recordset, you are "querying" the database for the records. You don't
need to "requery" immediately after querying.

3) You don't need to requery after deleting the record if you're done with
the recordset. The record is deleted with the Delete command. Requerying
just gives you a fresh set of records, which you don't need at this point.

4) All that being said, I don't see why you're deleting the last record. But
perhaps that's another story.......

BTW, I experimented with this to requery, and return to the record I
"requeried" from ..........

Private Sub Private Sub CmdRefsh()
'on error here
Dim RecID As String

RecID = Me.TxtID
Me.Requery
Me.TxtID.SetFocus
DoCmd.FindRecord RecID, acAnywhere, True, acSearchAll, True, acCurrent,
True

'error handling here
End Sub
This seems to do exactly what I want regardless of where I am in the
records. Any dramas using this?

From one hack programmer, thanks everyone for your help! :-)


That would work OK. But you should use the RecordsetClone code you were
previously given. It's cleaner and doesn't rely on form controls. My
understanding is that that works fine, but that you're having problems with
the MoveNext button, which is a separate thing.

Regarding the MoveNext code, you should set your code to break on all errors
(in code window, go to Options, General tab, Break on All Errors), and see
the line of code that's giving you an error. That should give you some clue.

Neil
Nov 13 '05 #14
MS

"Neil" <nj****@pxdy.com> wrote in message
news:2Z***************@newsread1.news.pas.earthlin k.net...
Private Sub CmdNxtRec_Click()
On Error GoTo Err_CmdNxtRec_Click
DoCmd.GoToRecord , , acNext
Dim IntNewrec As Integer

IntNewrec = Me.NewRecord
If IntNewrec = True Then
MsgBox "End of Data File. " _
& "Returning to last record. " _
& "To create new record, click ""New Record"" "
DoCmd.GoToRecord , , acFirst

Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("QryPatientInfo", dbOpenDynaset)
rst.Requery
rst.MoveLast
rst.Delete
rst.Requery
rst.Close
Me.Requery
DoCmd.GoToRecord , , acLast
End If


Some notes on the above:

1) You don't need the rst recordset. You can do everything in the
recordsetclone.

2) You don't need to requery after performing an OpenRecordset. By opening
the recordset, you are "querying" the database for the records. You don't
need to "requery" immediately after querying.

3) You don't need to requery after deleting the record if you're done with
the recordset. The record is deleted with the Delete command. Requerying
just gives you a fresh set of records, which you don't need at this point.

4) All that being said, I don't see why you're deleting the last record.
But perhaps that's another story.......

BTW, I experimented with this to requery, and return to the record I
"requeried" from ..........

Private Sub Private Sub CmdRefsh()
'on error here
Dim RecID As String

RecID = Me.TxtID
Me.Requery
Me.TxtID.SetFocus
DoCmd.FindRecord RecID, acAnywhere, True, acSearchAll, True, acCurrent,
True

'error handling here
End Sub
This seems to do exactly what I want regardless of where I am in the
records. Any dramas using this?

From one hack programmer, thanks everyone for your help! :-)


That would work OK. But you should use the RecordsetClone code you were
previously given. It's cleaner and doesn't rely on form controls. My
understanding is that that works fine, but that you're having problems
with the MoveNext button, which is a separate thing.

Regarding the MoveNext code, you should set your code to break on all
errors (in code window, go to Options, General tab, Break on All Errors),
and see the line of code that's giving you an error. That should give you
some clue.

Thanks Neil.

I'll give that a go to see where the problem is.

The reason I delete the record, is that the way this button works if you are
on the last record, pushing it one more time creates a new record. Hence the
Me.NeRecord check. If True, the record is deleted.

Maybe there is a better way?

Cheers!
Nov 13 '05 #15
Maybe this is where your problem is. The new record is not actually
_created_ until the user starts typing in the record. Thus, you may be at
the new record, but there is no record in the recordset. Thus, when you
delete the last record, you're actually deleting an existing record.

My guess is that you have your records in descending order, so that when
you're in the "first" record, it's actually last in the recordset (right
before the new record), and then you delete. That would explain why you get
an error when you use your code from the first record. Either way, error or
no error, you're deleting existing records.

Thus, your code :

IntNewrec = Me.NewRecord
If IntNewrec = True Then
MsgBox "End of Data File. " _
& "Returning to last record. " _
& "To create new record, click ""New Record"" "
DoCmd.GoToRecord , , acFirst

should work fine by itself, without having to delete anything. I think that
might clear up your problem.

BTW, you can eliminate the IntNewrec variable and make your code a bit
cleaner by just using:

If Me.NewRecord Then

Since Me.NewRecord is a boolean value (returns True or False) it can be used
by itself in the If statement, which looks for a True or False value.

Neil
Thanks Neil.

I'll give that a go to see where the problem is.

The reason I delete the record, is that the way this button works if you
are on the last record, pushing it one more time creates a new record.
Hence the Me.NeRecord check. If True, the record is deleted.

Maybe there is a better way?

Cheers!

Nov 13 '05 #16
"MS" <Em***@Myemail.com> wrote in
news:su********************@news-server.bigpond.net.au:

"Neil" <nj****@pxdy.com> wrote in message
news:2Z***************@newsread1.news.pas.earthlin k.net...
Private Sub CmdNxtRec_Click()
On Error GoTo Err_CmdNxtRec_Click
Regarding the MoveNext code, you should set your code to
break on all errors (in code window, go to Options, General
tab, Break on All Errors), and see the line of code that's
giving you an error. That should give you some clue.

Thanks Neil.

I'll give that a go to see where the problem is.

The reason I delete the record, is that the way this button
works if you are on the last record, pushing it one more time
creates a new record. Hence the Me.NeRecord check. If True,
the record is deleted.

Maybe there is a better way?

Cheers!

Yeah, simply prevent the use from going to the new record. You
can set the add new records property to false, is one way. Or you
can check the .current position of the recordset against the
total number of records in the recordset, and bypass the
..movenext if yoy are at the end of the set. I posted this on
thursday.

If Me.Recordset.AbsolutePosition + 1 _
< Me.Recordset.RecordCount Then
DoCmd.GoToRecord , , acNext
End If

The + 1 is because absoluteposition is zero based, and
recordcount is one based.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #17
Hey, Bob. I was looking over your code and I realized that "MS" would need
to use recordsetclone, not recordset, since he/she is using DAO, and would
need to set the recordsetclone's bookmark to the form's bookmark before
checking the absoluteposition property.

Neil

Maybe there is a better way?

Cheers!

Yeah, simply prevent the use from going to the new record. You
can set the add new records property to false, is one way. Or you
can check the .current position of the recordset against the
total number of records in the recordset, and bypass the
.movenext if yoy are at the end of the set. I posted this on
thursday.

If Me.Recordset.AbsolutePosition + 1 _
< Me.Recordset.RecordCount Then
DoCmd.GoToRecord , , acNext
End If

The + 1 is because absoluteposition is zero based, and
recordcount is one based.
--
Bob Quintal

PA is y I've altered my email address.

Nov 13 '05 #18
So be it.
air code

me.recordsetclone.bookmark = me.bookmark
If me.recordsetclone.absoluteposition +1 <
me.recordsetclone.recordcount
docmd.gotorecord,,acnext
end if

Is still a lot less than the hoops he's jumping through with his
current code

Nov 13 '05 #19
MS

"MS" <Em***@Myemail.com> wrote in message
news:DF********************@news-server.bigpond.net.au...
Access 97

I want to requery the data being displayed on a form, then I want to
return to the record I was in.

Why doesn't this code work?

Private Sub CmdRefsh_Click()
Dim RecId As Integer

RecId = Me.TxtID
Me.Requery

With Me.RecordsetClone
.FindFirst "[ID] = " & RecId
End With

End Sub

Thanks to everyone who made suggestions in this thread - it's been a big
help! :-)
Nov 13 '05 #20
So true.

<rq******@sympatico.ca> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
So be it.
air code

me.recordsetclone.bookmark = me.bookmark
If me.recordsetclone.absoluteposition +1 <
me.recordsetclone.recordcount
docmd.gotorecord,,acnext
end if

Is still a lot less than the hoops he's jumping through with his
current code

Nov 13 '05 #21

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.