473,320 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 10590
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tony Stoker | last post by:
I have a .Net web app that adds a record to a SQL database. After the user adds their record I want to have a link that will link them to their new record! The recordID is a AutoNumber in the...
6
by: CoolRiyaz | last post by:
I want to return record number with my query output. I dont' want to use IDENTITY function and temp table for this purpose as I am dealing with very huge data. any suggestions...
0
by: vinodkus | last post by:
I am beginner in ASP 1how can I return a recordset through a function in asp. 2>Suppose there are two buttons in asp. I want if I presss the first button then it should go to page1.asp and if I...
1
by: Peader | last post by:
Hi, I'm trying to complete a form that will search previous results entered in a table and return the row items based on a ID number. My current code is below: Private Sub cmd22_Click() ...
2
by: atrain | last post by:
Hi, I understand that MS Access is not really meant for multi-users if robust security is the ultimate concern...but I'm trying to create a work-around where a user logs in and is prompted to enter...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.