Requery Help

unit213

Active Member
Joined
Jul 11, 2003
Messages
427
Here's my situation. I have two separate forms...Form1 and Form2.
I have a command button on Form1 that runs a macro. When I push that button, I want
Form2 to requery. How would I go about doing that?

Thanks!

Dan
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Any input? I don't seem to have any trouble getting a subform to refresh (via requery), but
I haven't been successful in telling another form to requery.
 
Upvote 0
Hi Dan,

Code:
   with forms!formname
      'save record if changes have been made
      if .dirty then .dirty = false
      .requery
   end with
   DoEvents
~~~ DoEvents ~~~

DoEvents is used to make VBA pay attention to what is currently happening and look to see if the OS (Operating System) has any requests -- including the keyboard or noticing that a file has been deleted or created

ie: if you have a loop and want to be able to BREAK it with CTRL-BREAK, put DoEvents into the loop

DoEvents will also update values written to a form by a general procedure or code behind another form or report

A DoEvents is done when you use MsgBox, or are stepping through code (since it has to pay attention to the keyboard)

It is a good way to say, "Wake Up!"
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,078
Latest member
skydd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top