Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Macros / May 2008

Tip: Looking for answers? Try searching our database.

button to copy text and place it in new record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Slappy - 04 Apr 2008 18:49 GMT
I need to create a button on a form that will copy the text from a particular
field in a selected record and place the text in the same field for a newly
created record.

In other words...say I have a table with the following fields: 1.
line_number 2. product_type 3. cost.  I want to be able to select a line in
the table (say line number "29" with product "pizza" and cost "$10.00") and
press a button and have a new line number created with "pizza" already in the
field for product_type.  I presume I can do this with a macro group but I
don't know how to go about setting up the macros.  If someone could help it
would be greatly appreciated.
Ken Snell (MVP) - 13 Apr 2008 23:13 GMT
This type of activity is more easily handled with VBA code (in the form's
module) than with a macro, quite honestly. Can you accept the use of VBA for
this situation?

Signature

       Ken Snell
<MS ACCESS MVP>

>I need to create a button on a form that will copy the text from a
>particular
[quoted text clipped - 13 lines]
> it
> would be greatly appreciated.
Slappy - 10 May 2008 03:37 GMT
I guess I can, but I've used VBA code only very rarely and I'm a little
intimidated by it.  Would it be complicated?

> This type of activity is more easily handled with VBA code (in the form's
> module) than with a macro, quite honestly. Can you accept the use of VBA for
[quoted text clipped - 17 lines]
> > it
> > would be greatly appreciated.
Ken Snell (MVP) - 11 May 2008 03:18 GMT
In deference to your desire, here is a way to do it via a macro that is
attached to the On Click property of a command button that you need to put
in the Detail section so that it can be clicked for the desired record:

Action:  SetValue
   Item:  [NameOfPizzaControl].DefaultValue
   Expression:  [NameOfPizzaControl].Value

Action:  GoToRecord
   Record:   New

If you attach the above macro to the On Click property of the command button
(in a continuous forms view of a form, the button will appear on each
record; click the button on the record that contains the "pizza" value you
want to be used in the new record) that is in the Detail section of the
form, the macro will set the Default Value of the "pizza" control to the
current value, and then it will create a new record -- and you'll see that
"pizza" value in the control in that new record.
Signature


       Ken Snell
<MS ACCESS MVP>

>I guess I can, but I've used VBA code only very rarely and I'm a little
> intimidated by it.  Would it be complicated?
[quoted text clipped - 25 lines]
>> > it
>> > would be greatly appreciated.
Slappy - 11 May 2008 18:28 GMT
Thanks Ken!

> In deference to your desire, here is a way to do it via a macro that is
> attached to the On Click property of a command button that you need to put
[quoted text clipped - 43 lines]
> >> > it
> >> > would be greatly appreciated.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.