Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

2 buttons change to 1 button for one go

1 view
Skip to first unread message

Frank Situmorang

unread,
Jan 4, 2010, 1:25:01 AM1/4/10
to
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.
--
Frank Situmorang

Arvin Meyer [MVP]

unread,
Jan 4, 2010, 8:10:46 AM1/4/10
to
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.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Frank Situmorang" <FrankSi...@discussions.microsoft.com> wrote in
message news:80CA7F05-12C0-4CD3...@microsoft.com...

franksitumorang

unread,
Jan 4, 2010, 10:00:46 PM1/4/10
to
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 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.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
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/tutorials/aspnet/487aa9ed-8dd8-4e05-8df9-f1efa2b6054a/spywareadwareinternet-d.aspx

franksitumorang

unread,
Jan 5, 2010, 12:26:23 AM1/5/10
to
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 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.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
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/tutorials/aspnet/9734b345-d1a5-4898-8192-bfdf6fef6500/vbnet-event-managment-.aspx

Tom van Stiphout

unread,
Jan 5, 2010, 2:08:54 AM1/5/10
to
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

Arvin Meyer [MVP]

unread,
Jan 5, 2010, 5:58:12 AM1/5/10
to
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.


<Frank Situmorang> wrote in message
news:20101502612...@yahoo.com...

BruceM via AccessMonster.com

unread,
Jan 5, 2010, 7:45:15 AM1/5/10
to
Would DoEvents be of any use (rather than the Delay function)?

Arvin Meyer [MVP] wrote:
>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]

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1

Arvin Meyer [MVP]

unread,
Jan 5, 2010, 6:09:27 PM1/5/10
to
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.


"BruceM via AccessMonster.com" <u54429@uwe> wrote in message
news:a1a7f22aad3fe@uwe...

BruceM via AccessMonster.com

unread,
Jan 6, 2010, 7:51:41 AM1/6/10
to
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.

Arvin Meyer [MVP] wrote:
>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]

--
Message posted via http://www.accessmonster.com

0 new messages