Command Button to Close table and Open Form (1 Viewer)

Nancythomas

Registered User.
Local time
Yesterday, 16:05
Joined
Apr 20, 2010
Messages
59
Hi


I have a VB Script by a command button
(1) It imports data from a spread sheet into a Temp Table

(2) Closes the Temp Table after import and
(3) Opens a form to review the data before uploading it into the master table.


On Clicking the command Button the form opens in a flash and disappears.
How can I have the form open.
Not sure where it is incorrect in the script.
Here is the script:


Private Sub cmdUploadDate_Click()
DoCmd.SetWarnings False
If MsgBox("Do you want to Import the new data ?", vbYesNo, "title") = vbYes Then
DoCmd.TransferSpreadsheet acImport, , _
"TmpTable", FilePath.Value, True, ""
DoCmd.Close acTable, "TmpTable"
DoCmd.OpenForm "frmFIXUPTEMPTABLE", acNormal
End If
DoCmd.SetWarnings True
DoCmd.Close
Exit_CloseForm_Click:
Exit Sub
End Sub
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:05
Joined
Oct 29, 2018
Messages
21,474
Hi. Try removing or commenting out the DoCmd.Close line towards the bottom of the code.
 

June7

AWF VIP
Local time
Yesterday, 15:05
Joined
Mar 9, 2014
Messages
5,474
Why would table be open just to import data?
 

Users who are viewing this thread

Top Bottom