Refresh vs Requery

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the difference betwen:

DoCmd.RunCommand acCmdRefresh

DoCmd.Requery "ComboEventID" or DoCmd.Requery ""

Also what are the and pros and cons of using each?

thanks
 
Steve S said:
What is the difference betwen:

DoCmd.RunCommand acCmdRefresh

DoCmd.Requery "ComboEventID" or DoCmd.Requery ""

Also what are the and pros and cons of using each?

Refresh will refresh your recordset as far as modifications to existing
records and deletions to existing records and you will stay on the current
record. You would not see any NEW records that were added since you opened
your form.

Requery will do just that. Basically re-run the query that the current
recordset is based on. You will see all the changes that Refresh would show
you PLUS it will show you any new records. One side effect of a Requery is
that the form will be repositioned to 'RECORD 1 OF XXX'. In many cases that
would not be desirable.

As to Pros and Cons you use whichever is appropriate to the task.
 
thanks for the concise explanation.

I thought that one was left over from maybe Access 97 and the other a newer
replacement. thanks again.

Steve
 
Bibi said:
Is there a way to requery and return to the same record?

Save the value of the Primary Key field(s) into variable(s), issue the requery,
and then use the variable(s) value(s) to return to the record using Find.
 
I'm trying to do the same thing but can't quite get the FindRecord to work.

I get the following Error: "A macro set to one of the current field's
properties failed because of an error in a FindRecord action argument"

Can someone tell me what I'm doing wrong?

Private Function VolCboLstUpd()
On Error GoTo VolCboLstUpd_Err

Dim strX As String

DoCmd.GoToRecord , , acNext

strX = Me!idsVolRecID (this is the Primary key field)

DoCmd.Requery

DoCmd.FindRecord strX,,,,,acAll ( I'm sure the problem is I'm using
this incorrectly)

VolCboLstUpd_Exit:
Exit Function

VolCboLstUpd_Err:
MsgBox Error$
Resume VolCboLstUpd_Exit

End Function
 
Back
Top