2 buttons change to 1 button for one go

  • Thread starter Frank Situmorang
  • Start date
F

Frank Situmorang

Hello,

I have 2 buttons to append data, 1st to put the file into a folder, the 2nd
is to make an append from that folder.

How can I make it to be just one button. This is my VBA:

The 1st one:

On Error GoTo Err_SendtoOutbox_Click

Call Shell("xcopy C:\Churchdata\BkEnd\Hahomion_be.mdb
C:\Churchdata\ChurchdataConso\BkEnd\Hahomion_be.mdb/y")

Exit_SendtoOutbox_Click:
Exit Sub

Err_SendtoOutbox_Click:
MsgBox Err.Description
Resume Exit_SendtoOutbox_Click
End Sub


The 2nde one:

Private Sub HFSUPDate_Click()
On Error GoTo Err_HFSUPDate_Click

DoCmd.SetWarnings False 'Turn messages back OFF
DoCmd.OpenQuery "Qry_update_tblDivisions", acNormal, acEdit
DoCmd.OpenQuery "Qry_update_tblUnions", acNormal, acEdit
DoCmd.OpenQuery "Qry_update_tblRegions", acNormal, acEdit
DoCmd.OpenQuery "Qry_update_tblChurches", acNormal, acEdit
DoCmd.OpenQuery "Qry_updatetblAffiliations", acNormal, acEdit
DoCmd.OpenQuery "Qry_updateMemberAddressData", acNormal, acEdit
DoCmd.OpenQuery "Qry_UpdateMembershipdata", acNormal, acEdit
'Add your other query here
DoCmd.SetWarnings True 'Turn messages back ON

Exit_HFSUPDate_Click:
Exit Sub

Err_HFSUPDate_Click:
MsgBox Err.Description
Resume Exit_HFSUPDate_Click
End Sub

Thanks for any help.
 
A

Arvin Meyer [MVP]

Just put the code from both together without using the Exit and Error subs
from the first one. You may need to add a slight delay between the 2 in
order to allow the first to complete. There is a Delay procedure at:

http://www.datastrat.com/Code/Delay.txt

that can be added to a standard module, and called in your code between the
2 parts of your other code.
 
F

Frank Situmorang

Thanks Arvin, I will give it a try.

Frank



Arvin Meyer [MVP] wrote:

Just put the code from both together without using the Exit and Error subsfrom
04-Jan-10

Just put the code from both together without using the Exit and Error sub
from the first one. You may need to add a slight delay between the 2 i
order to allow the first to complete. There is a Delay procedure at

http://www.datastrat.com/Code/Delay.tx

that can be added to a standard module, and called in your code between th
2 parts of your other code
-
Arvin Meyer, MCP, MV
http://www.datastrat.co
http://www.mvps.org/acces
http://www.accessmvp.com

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Spyware-Adware-Internet Driver License Test Redux
http://www.eggheadcafe.com/tutorial...df9-f1efa2b6054a/spywareadwareinternet-d.aspx
 
F

Frank Situmorang

Hello Arvin,

I have tried it but it stop in the Dalay with error message " Compile error" saying "Argument is not optional"

This is my code:
Private Sub HFSUPDate_Click()
On Error GoTo Err_HFSUPDate_Click

Call Shell("xcopy C:\Churchdata\BkEnd\Hahomion_be.mdb C:\Churchdata\ChurchdataConso\BkEnd\Hahomion_be.mdb/y")

Delay

DoCmd.SetWarnings False 'Turn messages back OFF
DoCmd.OpenQuery "Qry_update_tblDivisions", acNormal, acEdit
DoCmd.OpenQuery "Qry_update_tblUnions", acNormal, acEdit
DoCmd.OpenQuery "Qry_update_tblRegions", acNormal, acEdit
DoCmd.OpenQuery "Qry_update_tblChurches", acNormal, acEdit
DoCmd.OpenQuery "Qry_updatetblAffiliations", acNormal, acEdit
DoCmd.OpenQuery "Qry_updateMemberAddressData", acNormal, acEdit
DoCmd.OpenQuery "Qry_UpdateMembershipdata", acNormal, acEdit
'Add your other query here
DoCmd.SetWarnings True 'Turn messages back ON

Exit_HFSUPDate_Click:
Exit Sub

Err_HFSUPDate_Click:
MsgBox Err.Description
Resume Exit_HFSUPDate_Click
End Sub

Thanks for your help

Frank



Arvin Meyer [MVP] wrote:

Just put the code from both together without using the Exit and Error subsfrom
04-Jan-10

Just put the code from both together without using the Exit and Error sub
from the first one. You may need to add a slight delay between the 2 i
order to allow the first to complete. There is a Delay procedure at

http://www.datastrat.com/Code/Delay.tx

that can be added to a standard module, and called in your code between th
2 parts of your other code
-
Arvin Meyer, MCP, MV
http://www.datastrat.co
http://www.mvps.org/acces
http://www.accessmvp.com

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
VB.NET Event Managment / Logging through Publisher / Subsriber Pattern
http://www.eggheadcafe.com/tutorial...8192-bfdf6fef6500/vbnet-event-managment-.aspx
 
T

Tom van Stiphout

On Mon, 04 Jan 2010 21:26:23 -0800, Frank Situmorang wrote:

I didn't read all your code, but this line is wrong and should be:
Call Shell("xcopy C:\Churchdata\BkEnd\Hahomion_be.mdb
C:\Churchdata\ChurchdataConso\BkEnd\Hahomion_be.mdb /y")

-Tom.
Microsoft Access MVP
 
A

Arvin Meyer [MVP]

You have to tell it how long to delay:

Delay(1.5)

would allow a delay of 1.5 seconds. The time interval (argument) is not
optional.
 
B

BruceM via AccessMonster.com

A

Arvin Meyer [MVP]

DoEvents is what the Delay function uses, but allows a specific amount of
time rather than letting the OS control whatever it wants to do for as long
as it requires.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Would DoEvents be of any use (rather than the Delay function)?
You have to tell it how long to delay:

Delay(1.5)

would allow a delay of 1.5 seconds. The time interval (argument) is not
optional.
Hello Arvin,
[quoted text clipped - 57 lines]
VB.NET Event Managment / Logging through Publisher / Subsriber Pattern
http://www.eggheadcafe.com/tutorial...8192-bfdf6fef6500/vbnet-event-managment-.aspx
 
B

BruceM via AccessMonster.com

OK, thanks. I have used DoEvents by itself, but am not convinced it is of
much use, at least not where I have tried to use it. For instance, I seem to
recall stepping through code, which seemed to run OK, but when I run the code
without stepping through it stumbles over something. I have tried in those
cases to add DoEvents, but I do not recall it helped. I wish I could think
of the specifics. Anyhow, if I run into that again I will try delaying for a
specific interval, and see if that helps.
DoEvents is what the Delay function uses, but allows a specific amount of
time rather than letting the OS control whatever it wants to do for as long
as it requires.
Would DoEvents be of any use (rather than the Delay function)?
[quoted text clipped - 9 lines]
 
Top