Requery help please (1 Viewer)

caman

Registered User.
Local time
Today, 21:47
Joined
Jul 28, 2002
Messages
18
I am sure this is an easy fix but it has got me stuffed.
I am trying to get my command button to requery a field on my form( OPEN FORM) I need the underlying Query updated before going to the next form. The button is currently running a macro to go to next form with certain parameters. But the requery is what is badly needed.
This is what I currently have

Private Sub Command122_Click()
On Error GoTo Err_Command122_Click

Dim stDocName As String

stDocName = "m1 next"
DoCmd.RunMacro stDocName

Exit_Command122_Click:
Exit Sub

Err_Command122_Click:
MsgBox Err.Description
Resume Exit_Command122_Click

End Sub


Can anyone help please ?
 

ghudson

Registered User.
Local time
Today, 16:47
Joined
Jun 8, 2002
Messages
6,195
Check the Access help files for Requery Method for all options. There are different methods for requerying an object or a record set.

HTH
 

caman

Registered User.
Local time
Today, 21:47
Joined
Jul 28, 2002
Messages
18
Cant find the info I need

Have had a look through the manual (cant find anything in the help files) and as far as I can tell I have to do the requery this way , in code, as its the only way to carry out a proper requery of the query.
Does this make sense to you ?
 

caman

Registered User.
Local time
Today, 21:47
Joined
Jul 28, 2002
Messages
18
not so easy as that

Excellent idea to save the record, I already do but that doesnt solve my problem.
The reason for this is that when finished with the current record I wish to go to the next record (up to 10000 records) that is using the same underlying query.
By updating the query I hope to avoid jumping into the same record that someone else is using ( could be up to 5 others in the same record set)
So has any one else got any ideas for me please ?
 

ghudson

Registered User.
Local time
Today, 16:47
Joined
Jun 8, 2002
Messages
6,195
caman, I am not sure of which version of Access you are using but when I search the the built in Access Help files "Index" (Menu Bar >>> Help / Contents and Index) for Requery Method I get a bunch of options of how to requery form objects and record set and control sources.

I did notice one command I have never tried before...

DoCmd.ShowAllRecords

Have you tried the DoCmd.ShowAllRecords method?

I recommend that you search the help files and try the examples given until you can find a solution to your quest.

HTH
 

Kenny

Registered User.
Local time
Today, 21:47
Joined
Mar 1, 2002
Messages
14
I use me.refresh as I find requery does not always work.
 

caman

Registered User.
Local time
Today, 21:47
Joined
Jul 28, 2002
Messages
18
Thanks for your replies

I shall go and try what has been suggested, thanks to all.
It may take me awhile as I have so many DB's to alter at the mo, although this problem is common to all.
As for version, I am writing on 2002 then converting to 97, I shall look at the help files at the office and see what I can find. (97)

Thanks all

caman
 

Users who are viewing this thread

Top Bottom