Requery

J

Jose Perdigao

Good morning,



I'm building a database in MS Access 2003.



In a form, when I invoke requery property, the cursor goes to the first
record.

I would like invoke requery and the cursor should be in the same record. I
mean if the current record is in 12/20 after requery, should be in 12/20 and
not 1/20.

How can I do this? I think trough bookmarks is possible, but I don't know
how to do it.



any suggestions?



Thanks,

josé Perdigão
 
G

Guest

First, Requery is a method, not a property.
Yes the BookMark property is how it can be done:

Application.Echo False 'Turn off screen updating so user wont see
flicker
strCurrentRec = Me.txtActivity 'Capture current unique record
identifier
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & strCurrentRec & "'" 'Find the record
Me.Bookmark = rst.Bookmark 'Position the recordset to the record
Set rst = Nothing
Application.Echo True

In the case above, [Activity] is the unigue value for the record.
 
J

Jose Perdigao

Some thing is wrong.
I apply your code in my database

Dim rs As DAO.Recordset, strCrt As Long
Application.Echo False 'Turn off screen updating so user wont
see flicker
strCrt = Me.WONID 'Capture current unique record
identifier
Me.Requery
Set rs = Me.RecordsetClone
rs.FindFirst "[WONID] = " & strCrt 'Find the record; WONID is long
Me.Bookmark = rs.Bookmark 'Position the recordset to the
record
Set rs = Nothing
Application.Echo True

the current record was 20/3740, I click on the button and it worked fine. I
moved to 50/3740, I click on the button and the current record was 20/3740
again. What is it wrong?

thanks,
josé perdigão

Klatuu said:
First, Requery is a method, not a property.
Yes the BookMark property is how it can be done:

Application.Echo False 'Turn off screen updating so user wont
see
flicker
strCurrentRec = Me.txtActivity 'Capture current unique record
identifier
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & strCurrentRec & "'" 'Find the
record
Me.Bookmark = rst.Bookmark 'Position the recordset to the
record
Set rst = Nothing
Application.Echo True

In the case above, [Activity] is the unigue value for the record.


Jose Perdigao said:
Good morning,



I'm building a database in MS Access 2003.



In a form, when I invoke requery property, the cursor goes to the first
record.

I would like invoke requery and the cursor should be in the same record.
I
mean if the current record is in 12/20 after requery, should be in 12/20
and
not 1/20.

How can I do this? I think trough bookmarks is possible, but I don't know
how to do it.



any suggestions?



Thanks,

josé Perdigão
 
G

Guest

It obviously tried to reposition the recordset. If it had not, it would have
been 1/3740. It is possible there can be duplicate [WONID] in your table? If
[WONID] is not unique, then you need a value that is. You can debug to see
if the FindFirst is finding the record by checking the value of rs.NoMatch
right after the FindFirst to see if it is finding a record.

Jose Perdigao said:
Some thing is wrong.
I apply your code in my database

Dim rs As DAO.Recordset, strCrt As Long
Application.Echo False 'Turn off screen updating so user wont
see flicker
strCrt = Me.WONID 'Capture current unique record
identifier
Me.Requery
Set rs = Me.RecordsetClone
rs.FindFirst "[WONID] = " & strCrt 'Find the record; WONID is long
Me.Bookmark = rs.Bookmark 'Position the recordset to the
record
Set rs = Nothing
Application.Echo True

the current record was 20/3740, I click on the button and it worked fine. I
moved to 50/3740, I click on the button and the current record was 20/3740
again. What is it wrong?

thanks,
josé perdigão

Klatuu said:
First, Requery is a method, not a property.
Yes the BookMark property is how it can be done:

Application.Echo False 'Turn off screen updating so user wont
see
flicker
strCurrentRec = Me.txtActivity 'Capture current unique record
identifier
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & strCurrentRec & "'" 'Find the
record
Me.Bookmark = rst.Bookmark 'Position the recordset to the
record
Set rst = Nothing
Application.Echo True

In the case above, [Activity] is the unigue value for the record.


Jose Perdigao said:
Good morning,



I'm building a database in MS Access 2003.



In a form, when I invoke requery property, the cursor goes to the first
record.

I would like invoke requery and the cursor should be in the same record.
I
mean if the current record is in 12/20 after requery, should be in 12/20
and
not 1/20.

How can I do this? I think trough bookmarks is possible, but I don't know
how to do it.



any suggestions?



Thanks,

josé Perdigão
 
J

Jose Perdigao

I don't know what's happen but now it's working fine,
Thanks a lot
jose´perdigao

Klatuu said:
It obviously tried to reposition the recordset. If it had not, it would
have
been 1/3740. It is possible there can be duplicate [WONID] in your table?
If
[WONID] is not unique, then you need a value that is. You can debug to
see
if the FindFirst is finding the record by checking the value of rs.NoMatch
right after the FindFirst to see if it is finding a record.

Jose Perdigao said:
Some thing is wrong.
I apply your code in my database

Dim rs As DAO.Recordset, strCrt As Long
Application.Echo False 'Turn off screen updating so user
wont
see flicker
strCrt = Me.WONID 'Capture current unique record
identifier
Me.Requery
Set rs = Me.RecordsetClone
rs.FindFirst "[WONID] = " & strCrt 'Find the record; WONID is
long
Me.Bookmark = rs.Bookmark 'Position the recordset to
the
record
Set rs = Nothing
Application.Echo True

the current record was 20/3740, I click on the button and it worked fine.
I
moved to 50/3740, I click on the button and the current record was
20/3740
again. What is it wrong?

thanks,
josé perdigão

Klatuu said:
First, Requery is a method, not a property.
Yes the BookMark property is how it can be done:

Application.Echo False 'Turn off screen updating so user wont
see
flicker
strCurrentRec = Me.txtActivity 'Capture current unique record
identifier
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & strCurrentRec & "'" 'Find the
record
Me.Bookmark = rst.Bookmark 'Position the recordset to the
record
Set rst = Nothing
Application.Echo True

In the case above, [Activity] is the unigue value for the record.


:

Good morning,



I'm building a database in MS Access 2003.



In a form, when I invoke requery property, the cursor goes to the
first
record.

I would like invoke requery and the cursor should be in the same
record.
I
mean if the current record is in 12/20 after requery, should be in
12/20
and
not 1/20.

How can I do this? I think trough bookmarks is possible, but I don't
know
how to do it.



any suggestions?



Thanks,

josé Perdigão
 
G

Guest

Good

Jose Perdigao said:
I don't know what's happen but now it's working fine,
Thanks a lot
jose´perdigao

Klatuu said:
It obviously tried to reposition the recordset. If it had not, it would
have
been 1/3740. It is possible there can be duplicate [WONID] in your table?
If
[WONID] is not unique, then you need a value that is. You can debug to
see
if the FindFirst is finding the record by checking the value of rs.NoMatch
right after the FindFirst to see if it is finding a record.

Jose Perdigao said:
Some thing is wrong.
I apply your code in my database

Dim rs As DAO.Recordset, strCrt As Long
Application.Echo False 'Turn off screen updating so user
wont
see flicker
strCrt = Me.WONID 'Capture current unique record
identifier
Me.Requery
Set rs = Me.RecordsetClone
rs.FindFirst "[WONID] = " & strCrt 'Find the record; WONID is
long
Me.Bookmark = rs.Bookmark 'Position the recordset to
the
record
Set rs = Nothing
Application.Echo True

the current record was 20/3740, I click on the button and it worked fine.
I
moved to 50/3740, I click on the button and the current record was
20/3740
again. What is it wrong?

thanks,
josé perdigão

First, Requery is a method, not a property.
Yes the BookMark property is how it can be done:

Application.Echo False 'Turn off screen updating so user wont
see
flicker
strCurrentRec = Me.txtActivity 'Capture current unique record
identifier
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & strCurrentRec & "'" 'Find the
record
Me.Bookmark = rst.Bookmark 'Position the recordset to the
record
Set rst = Nothing
Application.Echo True

In the case above, [Activity] is the unigue value for the record.


:

Good morning,



I'm building a database in MS Access 2003.



In a form, when I invoke requery property, the cursor goes to the
first
record.

I would like invoke requery and the cursor should be in the same
record.
I
mean if the current record is in 12/20 after requery, should be in
12/20
and
not 1/20.

How can I do this? I think trough bookmarks is possible, but I don't
know
how to do it.



any suggestions?



Thanks,

josé Perdigão
 

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