Command Button to Close table and Open Form

Nancythomas

Registered User.
Local time
Today, 11:46
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
 
Hi. Try removing or commenting out the DoCmd.Close line towards the bottom of the code.
 
Why would table be open just to import data?
 

Users who are viewing this thread

Back
Top Bottom