Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Solved: Access, How to Change an embedded Macro in a Button.


(!)

ginaw's Avatar
ginaw ginaw is offline
Member with 81 posts.
THREAD STARTER
 
Join Date: Sep 2010
14-Sep-2011, 03:21 PM #1
Solved: Access, How to Change an embedded Macro in a Button.
I created a button on my input form to duplicate record. This works fine but I want the record to duplicate and then clear the start date and end date for new entry. Does anyone know how I can do this?
OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 18,524 posts.
 
Join Date: Mar 2005
Location: UK
15-Sep-2011, 05:46 AM #2
Are you using a "Macro" or VBA code?
ginaw's Avatar
ginaw ginaw is offline
Member with 81 posts.
THREAD STARTER
 
Join Date: Sep 2010
19-Sep-2011, 10:57 AM #3
OBP,

I created a button with the button wizard that Duplicates the Record. It is a Macro. But if there is a better way in VBA than please let me know.
OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 18,524 posts.
 
Join Date: Mar 2005
Location: UK
19-Sep-2011, 11:55 AM #4
Normally the Button Wizard uses VBA code, which is why I asked, it is simple to add a bit of code on the end to clear the 2 fields.
ginaw's Avatar
ginaw ginaw is offline
Member with 81 posts.
THREAD STARTER
 
Join Date: Sep 2010
20-Sep-2011, 03:19 PM #5
Obp
I have uploaded a snapshot of the embedded macro. Can you help me around this? Or should I add VBA code somewhere?
Attached Thumbnails
Solved: Access, How to Change an embedded Macro in a Button.-9-20-2011-2-11  
OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 18,524 posts.
 
Join Date: Mar 2005
Location: UK
21-Sep-2011, 01:09 PM #6
What is the name of the button?
What are the actual names of the 2 fields that you want to clear?
ginaw's Avatar
ginaw ginaw is offline
Member with 81 posts.
THREAD STARTER
 
Join Date: Sep 2010
22-Sep-2011, 10:40 AM #7
OBP,

The name of the button is Duplicate Record. The 2 fields are DateStart and DateEnd.
OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 18,524 posts.
 
Join Date: Mar 2005
Location: UK
22-Sep-2011, 01:22 PM #8
Try this in the On Click Event Procedure
On Error GoTo Err_Duplicate_Record_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
me.DateStart = ""
me.dateEnd = ""

Exit_Duplicate_Record_Click:
Exit Sub

Err_Duplicate_Record_Click:
MsgBox Err.Description
Resume Exit_Duplicate_Record_Click
ginaw's Avatar
ginaw ginaw is offline
Member with 81 posts.
THREAD STARTER
 
Join Date: Sep 2010
22-Sep-2011, 04:29 PM #9
OBP,
The Embedded Macro is on the 'On Click' event on the Duplicate Record Button.
ginaw's Avatar
ginaw ginaw is offline
Member with 81 posts.
THREAD STARTER
 
Join Date: Sep 2010
23-Sep-2011, 09:34 AM #10
OBP,

I replaced the macro with the code above and it worked!! You are awesome!! As always!!

Thank you.
OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 18,524 posts.
 
Join Date: Mar 2005
Location: UK
23-Sep-2011, 02:13 PM #11
Sorry, I should of explained that you needed to replace the macro. Well done figuring it out.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
access, buttons, edit embedded macro

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑