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
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

unit213

Active Member
Joined
Jul 11, 2003
Messages
427
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.
 

strive4peace

Well-known Member
Joined
Jul 6, 2009
Messages
678
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!"
 

Watch MrExcel Video

Forum statistics

Threads
1,122,569
Messages
5,596,915
Members
414,110
Latest member
docops

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
Top