Create a new record using a macro?

I'm building a relocation database. It is built similarly to the expense reports template already in Access 2007. I have a main form "Expense report" and a subform "Expense Details".

On the employee table Clock # is the primary key and cannot be duplicated. What I want to do is create a new expense report for each new employee (a dummy record to populate a zero value for each category of expense type).

So when I enter the employee and save the record it would automatically create a record with all the specified values, only changing the clock # (as input on the employee form).

I don't want to build the default values because each employee may have multiple expense reports with different expense types.

My thought would be to copy the entries in say "record 4" (autonumber field), only changing the clock # as input on the employee form.

Sponsored Links:

Related Topics

Button to Create New Record
I would like to create a button with a macro that will bring up a blank form to create a new record (as opposed to going directly to the datasheet table). There are options to Save a Record, Refresh a Record, Search for A Record, Delete a Record and Show All Records, but I don't see a macro to create a new record. Can this be done? If not through a macro, then


MACRO for emailing a single record
me please. I am very new to Access

I have created a database for recording Quality issues from various customers. I have also created a FORM for ease of entry of data. What I want to do is create a BUTTON for this FORM that when clicked will create a PDF of the current record only and attach it to an email. I have tried to use the SendObject action and have set up the email side of things but the problem I have is that the PDF that has been created has ALL of the records listed in it and not a singular record.

I suppose a macro similar to PRINT RECORD would be required.

Would this be able to be done as a macro or would VB be required?

I hope to hear from someone soon


Search for Record, create new if not existant
I'm trying to create a macro to execute after a form text box updates. I'm aware of how to attached the macro to the "After Update" event but I'm having trouble with the macro itself.

What I'm looking to do is take the value of cell that has just been updated and use that for the search criteria to look at the history table and search for that value in a specific column. If the value exsists, do nothing, if it doesn't exsist create a new record and populate the value using the search criteria.

The only start I have is I believe i've found the code to create a new record which I think is : "DoCmd.GoToRecord , , acNewRec


IsNull and DLookUp - finding if record exists
I'm trying to write a macro that will check if a certain record exists. If not, it will display a message box and stop the macro. If it does exist, the rest of the macro will run. My condition is:

Code...

When I try to run my macro, nothing happens, regardless of the value in txtSerialNumber (so regardless if the Serial Number exists or not). When I remove these lines, my macro runs fine.


Macro on New Record
I would like to record the user's name that enters new records.

To accomplish this I am thinking I need to run a macro that that updates the appropriate field but I am not sure of the best event to trigger the macro. Perhaps there is a better way


Need to run a macro that filters only current record
I have a very simple form with some command buttons that open other forms which I want to contain data related only to the active record. Currently, the forms that open with the macro only open with the first record in the database no matter which record I'm viewing on the main form. Can anyone help me set up the correct filter in the macro for this


Stoping Macro on last record
I'm trying to run a macro which loops going to each record on a form. I know I can run a macro within a macro and use the repeat count & repeat expression. Using the repeat count isn't an option as I cannot be sure how many records I have at any one time. I would like to use the Repeat expression option, to stop the macro when it reaches the last record, but I am unable to figure out a way to do it


Macros to create records?
Can you use a macro to create a record? If so, how? I assume you could just write VB code to do it, but I don't know VB, so I was gonna try to get a macro to do it for me.


Macro to open form to a particular record
I have two forms: "Employees" & "Employee Badge".

I want to create a button in "Employees" form and press it, so that "Employee Badge" form opens displaying only the record that was on the "Employees" form at the time I pressed the button.

I have created a macro to do this. The "Action" of this macro is "OpenForm".

Can someone please tell me what I need to put in the "Where Condition" of the macro?
Or is that "something" entered in "Filter Name" of the macro?


How do I get a macro to move to the next step after a conditional stop
How do I macro to step to the next action after a conditional stop? I have a button to open a form to the record selected. I want a message box to show if no record is selected.

In my macro I have:

IsNull([employee_ID]) MSGBox
StopMacro

OpenForm
SearchForRecord
Close

When the [employee_ID] is null the message dispalys and the macro stops, however the open form button will nolonger work even if I select a record. How do I get my macro to work after it has stopped


Printing in Landscape via an Embedded Macro
I created a form and added a button with the embedded Macro that prints the current record only. The macro arguments a select record, print record. My problem is that it prints the record in portrait. I need it to print landscape. How do I change it from portrait to landscape?


Last Record in macros ACCESS 2007
I used to have a macro that calcultated fields in a form of an application Ive made on ACCESS 2003, from the first to the last record. When I tried it on a computer with ACCESS 2007 the macro doesnt stop. I dont know how to order the macro to stop when it reaches the last record in ACCESS 2007. Can somebody help me, please?


Create a macro
You can create a macro (macro: An action or set of actions that you can use to automate tasks.) to perform a specific series of actions (action: The basic building block of a macro; a self-contained instruction that can be combined with other actions to automate tasks. This is sometimes called a command in other macro languages.), and you can create a macro group (macro group: A collection of related macros that are stored together under a single macro name. The collection is often referred to simply as a macro.) to perform related series of actions.
In Microsoft Office Access 2007, macros can be contained in macro objects (sometimes called standalone macros), or they can be embedded into the event properties of forms, reports, or controls. Embedded macros become part of the object or control in which they are embedded. Macro objects are visible in the Navigation Pane, under Macros; embedded macros are not.
What do you want to do?: Learn about the Macro Builder, Create a standalone macro, Create a macro group, Create an embedded macro, Edit a macro, Use conditions to control macro actions, Learn more about macro actions.


How to change a form/report record source using a macro
I searched through the posts looking for a way to change a form or report's record source using a macro. I found several discussion on how to do this with VBA code (see below) but none using a macro to do this.

Basically I want to be able to click on various buttons on a form, with each button opening the same form but with differenent recordsource. I do not want to do this with VBA unless it is the only way to do this.

Is it possible to do this with a macro? I am using Access 2007.


Macro to add record and run query
hopefully this'll be a really easy thing that will be a bit embarrassing, bit quick

anyway I have a button (on a form) and using the wizard have got it to add a new record
and have a seperate update query for something and thought itd be handy if the button could run that query as well, so immediately thought of macros and just to have the button run the macro
so gone to make a macro and got it to run the query easy, only thing I havent seen in the things that the macro will do is add a new record
does anyone know how to make the macro add a new record?
not too experienced with macros as im sure you can tell


Macro Question
There are several macro's in a database that I did not create. I am wanting to view what the macro actually does, but I do not know how to look at the code that runs when the macro is executed. Can someone tell me how to do this


Setting the display of a combobox after a record is updated
I used a combobox to select a record in table A. The combobox displays the desired person's name in it and the form shows the correct information. After updating the record, I save it using a macro connected to a button. The macro also creates a new record. The first record in table A is blank so nothing appears in the combobox when the form is opened. How do I get the combobox to show the first record (blank) after the updated record is save and a new record is initiated.

You may have a completely different way of setting the display in a combobox after a record is saved. If so


Loop in access 2010 macro
I am trying to create a macro to loop through all the records in a form and replace a number field until it hits a record with a specific entry.
I am unable to find the command in the macro drop-down box. The command I am looking for is Do Until.
I would prefer to work through macros rather than in VBA as I don't know how to program using VBA


Manual Conversion of a Macro to VB
I have a combo box that i created with a wizard that you drop down and it lists the name of the record and goes to that record. After looking at the after update in the properties - it shows an embedded macro .

The macro says Search for record and the condition is
, , First, ="[Rule Acronym] = " & "'" & [Screen].[ActiveControl] & "'"

I wanted to create a VB module for the after update and add a couple steps. What is the proper syntax for the Search For Record?
DoCmd.SearchForRecord , , First, ="[Rule Acronym] = " & "'" & [Screen].[ActiveControl] & "'"


Store the date and time when a record is modified
You can keep track of when records in a table are last modified, by using a form with a macro. When the form is used to modify a record, the macro stores the date and time in the table. Only the most recent modification date and time are stored.
In this article
* Overview
* Before you begin
* Step 1: Add timestamp fields to a table
* Step 2: Create a macro that records the date and time
* Step 3: Add the macro to a data-entry form