Open Form in DataSheet View then Process on Close

psycoperl

Active Member
Joined
Oct 23, 2007
Messages
339
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
  3. Web
Is there a way from form1 to open form2 in Datasheet view and then when form2 is closed to continue processing in form1?

form2 is "frmStudentBatchLoad"

on Form1 I have
Code:
Private Sub cmdOpenStagingArea_Click()

    DoCmd.OpenForm "frmStudentBatchLoad", acFormDS, , , , acDialog
    
    MsgBox DLookup("Count([Emplid])", "temptblStudentToLoad")
    
End Sub

When I click on the button that triggers the code I do not get the form opened properly, and the MSGBox appears automatically.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
When you invoke a sub or function, you cannot expect it to stop processing at some arbitrary point. The command is processed (opens the form) and when that is done, it follows through on the next command as it is designed to do.
I do not get the form opened properly,
If you don't specify a view in code, it defaults. Make data sheet the default view in design mode and simply open the form to get data sheet view. Anything you don't want to happen until the second form closes would have to either
- be coded in that form close event
- call code from a standard module
- or some trick that you can trigger in code but would not likely be effected (yes I meant effected, not affected) by the user. This would be my very last choice.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,829
Messages
6,162,232
Members
451,756
Latest member
tommyw

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